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.

WordPress uploads fail. max_upload_filesize set correctly but still fails

Question:

My WordPress blog fails on uploads over a certain size. I’m made sure that php’s max_upload_filesize is set correctly in my php.ini. Why do the uploads still fail.

Answer:

Make sure that post_max_size is also set to be at or above the size file you want to upload. If not, your wordpress uploads will fail. You can set this in your etc/php.ini file. The change takes effect immediately as soon as you save and/or upload the new php.ini file.

Fixing Silverlight install error : date.timezone set and valid

Silverlight date.timezone Error screenshot

Question:

I get the an error when installing Silverlight regarding date.timezone. How can I fix this?

Answer:

With newer versions of php (PHP 5.3.0 and above), the date.timezone must be explicitly set. You can fix this by going into your etc/php.ini directory (create if does not exist) and add the line for date.timezone. An example is:

date.timezone = 'America/New_York'

Be certain to only use timezone’s listed at:

http://www.php.net/manual/en/timezones.php

Timezones like ‘US/Eastern’ no longer work.

It can be very frustrating because php will not complain if you use ‘US/Eastern’ and phpinfo() will show the value as set but Silverlight will not work with those settings. ‘US/Eastern’ and others are only included in php for backwards compatibility.

Increase php timeouts with .htaccess

If you are running mod_php you may experience problems with big uploads and imports (or other long running processes).

You can adjust php’s default timeouts using a .htaccess file.

Create a file called .htaccess and put the code:

# increase php time-out limits
php_value max_execution_time 1000
php_value max_input_time 1000

inside it. Put the .htaccess file into the top-most directory of your site. If you already have a .htaccess
file, add the code above to the end of it.

This should solve you problem in most cases.

If it does not, try to increase the times (1000). If the problem persists, open a support ticket and include the URL, click path and any needed usernames and passwords. We will duplicate the problem and attempt to adjust your php execution times to make your script work.

Note: if you are running php as a cgi, you’ll need to adjust your /etc/php.ini file. Adding directives to .htaccess files has no effect on installs using php-cgi.