After a recent upgrade from PHP 5.2 to PHP 5.2 on a CentOS Linux server I ran into some issues with a couple applications I had installed. One of the errors I noticed was generated by set_magic_quotes_runtime function which was deprecated in PHP 5.3. Fixing this error is easy by modifying any PHP files that include set_magic_quotes_runtime as shown in the below example.
PHP Deprecated: Function set_magic_quotes_runtime() is deprecated
- [03-Jan-2011 20:01:30] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:01:34] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:01:34] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:01:34] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:02:35] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:02:35] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:02:53] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
- [03-Jan-2011 20:02:53] PHP Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/zencart/zc_install/includes/application_top.php on line 22
To resolve the errors output above I modified the application_top.php file by commenting out the below PHP code from line 22. You can comment out a line of PHP code by simply adding “#” in front of the line as shown in the below example output.
Original set_magic_quotes_runtime() PHP Function:
- # set_magic_quotes_runtime(0);
New PHP Function:
- ini_set("magic_quotes_runtime", 0);
Insert the above right below the commented out line and it should provide the same output as what was commented out and thus resolve the errors you were seeing previously in the PHP errors log file.