How do I setup custom php.ini settings?

We have recently updated many of our shared hosting servers to php 5 with phpSuExec enabled. This update was essential for security and allows our customers to take advantages of all the new features of php 5. While the vast majority of our customers will not be affected by this update, you may find that some features no longer work on our shared servers.

Most notably, users are not able to have php flags in their .htaccess file. Having php flags in .htaccess files is a common cause of internal server errors on servers with phpSuExec enabled. One way around this is to create a custom php.ini file with the php values you need. You need to place this in every directory that needs to use this as the custom php configuration values you set in your php.ini are not recursive. This file should have the following permissions: 644 permissions with the owner cpanelusername:cpanelusername. If we take your cpanel username to be bobbob1, your php.ini file should look like this in your file manager or ftp client: -rw-r--r-- 1 bobbob1 bobbob1 21 Nov 20 18:57 php.ini.

Once your php.ini file has been created you can populate with the php configuration values you need to override on the server. The syntax generally follows this format: phpconfigValueToOverride = value. The most common php value you need to set for many of the scripts that we offer via Fantastico is register_globals. To enable register_globals you simply place this in your php.ini file: register_globals = On. Conversely, you can turn off register globals: register_globals = Off. Other common configuration changes include: upload_tmp_dir, display_errors, session.save_path.

Note: we do not allow our shared hosting customers to change their memory limit to anything past 32 M to protect the quality of service for our shared hosting environment.

You can check your current PHP settings by using the phpinfo() function. Simply place phpinfo(); in a new file with a .php extension. Again, it is important to note that any changes you make in the php.ini are not recursive meaning they do not carry over to other directories in your account. You must have a php.ini in every directory needing your custom php.ini.

Was this answer helpful?

 Print this Article

Also Read

How do I create a redirect for my site?

These rules should be added to your .htaccess file located in your public_html folder. This rule...

How do I perform a trace route?

Traceroute (tracert) works by sending a packet to an open UDP port on a destination machine. For...

custom php.ini

PHP Selector allows customer to edit php.ini settings. Admin has a full control over which...

How do I limit what the search engines can index ?

Various search engines such as Google have what are called 'spiders' or 'robots' continually...

CAPTCHA: Telling Humans and Computers Apart Automatically

A CAPTCHA is a program that protects websites against bots by generating and grading tests that...