Search Your Web Hosting PlanCompare Webhosting ProvidersTour Top Web Hosting
Tell a Friend Bookmark and Share
In-depth Web Hosting Directory - Web Hosting Reviews and Consumers Guide

php.ini

php.ini is simply a configuration file. It is read when a PHP script begins. Some hosts allow custom php.ini files and if they do, this will be listed as a benefit of the hosting plan. Most webmasters will never use a custom php.ini file however if a programmer is working on your site, or you are a programmer, then having the ability to create a custom php.ini file can bring many benefits.

The function of a php.ini file is to customize how PHP scripts are interpreted by the server. Things like data handling, file handling, performance and security can be addressed in a php.ini file. php.ini is usually located in the root directory of a server and PHP looks for it in the path that is designated by PHPRC which is an environment variable. An example php.ini file can be seen at: http://www.reallylinux.com/docs/php.ini

php.ini can be edited in a text editor like notepad. You should never create or edit this file in Microsoft Word as extra characters are often inserted that will cause the file to function wrong.

php.ini is used to control the behavior of PHP as sometimes the default settings are not suitable for particular applications. Most web hosts take complete control over php.ini as a security measures but some will allow their customers to create a custom php.ini

It is recommended that register_globals is always set to off as if its on it is a security risk as variables can be passed from one script to another.

It is also recommended that magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase are also set to off.log_errors is recommended to be set to on for obvious reasons (to be able to view any errors).

php.ini includes

Other possible settings that can be changed in php.ini include:

  • include_path - this is where PHP looks for files when require_once or include_once is used.
  • auto_prepend_file - a file to run before PHP runs your script.
  • auto_append_file - a file to run after PHP has run your script.

sendmail_from, extension_dir, upload_tmp_dir and session.save_path are other settings that are often modified in php.ini

Because you do not control the server in a regular hosting environment (unless you are using a dedicated server), php.ini can not be used as it would if you owned the server. This is to avoid you overwriting global server settings rather than just the settings for your account.

php.ini is a powerful file which is great for programmers, database administrators and server administrators, but it should not be tampered with if you are unfamiliar with PHP.

Back
 Home |  Contact Us |  About Our Web Hosting Directory |  Vote Your Best Host |  Privacy Policy |  Terms of Service |  Site Map