Hide eregi() deprecated errors

Question:

My script gives errors like:

Deprecated: Function eregi() is deprecated in /home/my_username/www/path/contact/include/fgcontactform.php on line 548

Why is this occuring? How can I fix it?

Answer:

Newer php versions are removing support for the eregi() function. Your script will continue to work but using normal php.ini settings the deprecated errors are shown. You can hide the errors by adding:


error_reporting = E_ALL & ~E_DEPRECATED

to your /home/username/etc/php.ini file

Create the file if it does not exist. If you already have a error_reporting line, modify it hide E_DEPRECATED

If you are on a VPS, edit /etc/php.ini and restart httpd if you are running mod_php.

You should also work to update your script to no longer call the deprecated functions as future versions of php will remove support for the functions completely.