Magic quotes enabled?

Under Configure command, one of the stuff I have: -enable-magic-quotes

But under Configuration> PHP Core I have:

magic_quotes_gpc Off Off
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off

Very strange issue here. What’s the next step?

Thanks a lot

Where do you get this message? Is it in FreePBX Notices?

OK, do this:
Start mysql with (if you run it with the standard user and password, if not, then change to your user/password):

mysql --database=asterisk -uasteriskuser -pamp109

Then do:

select id, display_text, level from notifications;

Output should be something like:

+------------+-------------------------------------------+-------+
| id         | display_text                              | level |
+------------+-------------------------------------------+-------+
| AMPDBPASS  | Default SQL Password Used                 |   500 |
| AMPMGRPASS | Default Asterisk Manager Password Used    |   500 |
| NOEMAIL    | No email address for online update checks |   600 |
| MQGPC      | Magic Quotes GPC                          |   400 |
| BADDEST    | There are 1 bad destinations              |   400 |
+------------+-------------------------------------------+-------+

Now do this:

delete from notifications where id='MQGPC';

Refresh your FreePBX to see if the message is gone. If it is then do:

/etc/init.d/httpd restart

Check if the message is back. If it is, well, then we will check next thing.

The message didnt appear from system status. And the SQL output came right back up after an httpd restart:

+------------+----------------------------------------------------+-------+
| id         | display_text                                       | level |
+------------+----------------------------------------------------+-------+
| MQGPC      | Magic Quotes GPC                                   |   400 |
| NOEMAIL    | No email address for online update checks          |   600 |
| NEWUPDATES | There are 17 modules available for online upgrades |   300 |
| NEWMODS    | 53 New modules are available                       |   600 |
+------------+----------------------------------------------------+-------+

Create a file in /var/www/html called testm.php with this in it:

<?php
print("Magic Quotes = ". get_magic_quotes_gpc());
?>

Run it:

php testm.php

Report back the number that you get. Then do this:

php --version

And report back the output

Here it is for one of the boxes with the message. The other ones might have a later version:

PHP:  Error parsing /etc/php.ini on line 233
Content-type: text/html
X-Powered-By: PHP/4.3.11

Magic Quotes = 1

[root@sip ~]# php --version
PHP:  Error parsing /etc/php.ini on line 233
PHP 4.3.11 (cgi) (built: Jul 10 2006 15:19:32)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

You do have Magic Quotes set to On as the output is ‘1’. And the code in FreePBX use the function get_magic_quotes_gpc(). So the error is in your setup, not in FreePBX.
And, you have an error on your php.ini file at line 233, please check that. What do you have on line 233?

In both my php.ini files:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60     ; Maximum amount of time each script may spend parsing $
memory_limit = 64M      ; Maximum amount of memory a script may consume (8MB)

Well, you maybe don’t see it, but I do:
max_input_time = 60 ; Maximum amount of time each script may spend parsing $

Note the tiny $ at the end after the word parsing?
Get rid of that and redo your test.

I cant get rid of the tiny $

How can I erase that? I erased the whole line and the $ is still there

(I didn’t save the file so I lost nothing)

Thanks a lot

What editor do you use?
First do a backup of the file (cp php.ini php.ini.org), then open php.ini with your editor, go to line 233 and press the key “end” to see how long the row is.

I use nano.
I saw how long the row was from beforehand. When I use WinSCP to open the file, I dont see the $ there at all.

If you want me to use vi, please give me exact instructions including how to get out of it because vi is way beyond my expertise

Thanks for all your time

On your Linux, try to run the command ‘mc’, it should start Midnight Commander. If it does not, install it with ‘yum install mc’ (if you are using Centos).
Find your php.ini and press F4, this opens up an editor that you can use to go to line 233 and look for strange characters. Edit your file, press F2 to save then F10 to exit. ‘/etc/init.d/httpd restart’ then do the php --version and php testm.php to see it you have fixed the issue.

There’s no $ sign when using mc

Then you must have an other error in your php.ini, look carefully for any missing’;’ or other errors.
Try to just save the file from within mc to see if that solves the issue. Not until the error in your php.ini goes away you will have a functional installation.
Test with the testm.php until you get your Magic Quotes = 0, when you get a 0 your magic quotes will work with FreePBX as the function get_magic_quotes_gpc() is what is used in FreePBX.

On the other php file, /etc/php.ini, this is on line 233: (8MB)
I commented it out and the magic quotes message went away!
Will commenting out that line affect anything?

Here is what it says above this line:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60     ; Maximum amount of time each script may spend
memory_limit = 100M      ; Maximum amount of memory a script may consume
;(8MB)

I did not touch the php.ini file ever in my life for this to happen, because I can see that on a working php file, the (8MB) is on the same line as a commented out sentence. If this isn’t supposed to happen, and commenting out that line wont affect anything, then this can be a FreePBX bug since this happened both on a trixbox and elastix system. I realized it happen on the 2nd trixbox system once I changed the memory_limit from 64M to 100M when I was prompted to.

Thanks a lot

Thanks a lot

It’s not a FreePBX bug, the get_magic_quotes_gpc() function report whether magic quotes is enabled in php or not, and it reports on it. That’s it.

Philippe, if that is so, how did the “(8MB)” word get added to its own line just out of nowwhere? I am looking at other trixbox and Elastix installs of mine, and they are connected with the previous line. Note that these were all versions that were upgraded from 2.4 or younger to 2.5 and this is when the problem started to happen. Are you able to duplicate this?
Remember, the “8MB” line just decided to use up its own line and that’s probably what caused magic quotes to enable itself. How did that happen without me touching php.ini unless it was to change the memory limit from 64 to 100M?

FreePBX NEVER touches the php.ini!
The only explanation of this error is your skill in editing the php.ini. You said that you used WinSCP, you did not by any chance copied the file from your Linux to Windows, edited the file and copied it back with the use of WinSCP?

ja133,
as already mentioned, we don’t touch that file, ever. The issue may have been there and probably was for a long time. We only started making this check in 2.5 which is why you were never notified prior to 2.5.