Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Comments starting with '#' are deprecated" message via CLI

Tags:

php

I have a very limited access to server php configuration files .

when I run some of my cron scripts which involves writing log files , I am getting a warning like this

Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0 

I googled a lot to find the reason , I got to know that we need to replace the '#' with ';' in ming.ini file .

I informed this to my server admin to fix this

below is the link where I got this fix

How to fix: PHP Deprecated errors

Later , for some of the scripts issue got fixed but for some of them I started getting same error in different php configuration file

eg .

PHP Deprecated:  Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0  PHP Deprecated:  Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/imap.ini on line 1 in Unknown on line 0 

What actually is the problem , below is my server specification

OS : ubuntu 12 php : 5.4

Is this a usual behaviour do I need to change these comments from '#' to ';' in every file .

OR is this an issue with PHP 5.4 .

Please provide any information if you have or an easy way to avoid this error in application level ( code )

Thanks in advance for reading this post

like image 521
Aravind.HU Avatar asked Dec 28 '12 18:12

Aravind.HU


People also ask

How do you start off a comment?

Use the introduction to get the reader's attention and interest in the topic. Define the problem you are going to discuss and provide a short overview on what you think and why. Summarize the most important arguments that best support your opinion.

What is the opening tag for a comment?

An HTML comment begins with <! –– and the comment closes with ––> . HTML comments are visible to anyone that views the page source code, but are not rendered when the HTML document is rendered by a browser.

What are inline comments?

Inline comments are comments made by an instructor that appear directly on top of your paper. These comments are usually brief.

What is the tag for commenting 1 line at a time?

-- --> is an HTML comment tag.


1 Answers

You can patch the comments with this shell command:

find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \; 

It basically finds all .ini files below /etc/php5/cli/conf.d/ and executes sed on it, which replaces any # comment line literal by ;.

like image 68
Gumbo Avatar answered Sep 20 '22 13:09

Gumbo