How to Configure PHP Settings for Your Server

PHP is an open source scripting platform that rests at the heart of many websites that extensively use server side scripting to create dynamic websites and content management systems. To run a website with live content and transactional features the combination of “Linux, Apache, MySQL and PHP” commonly referred to as LAMP is quite popular.

It is possible to fine tune the PHP configuration files – copied when you install PHP on your web server – to customize the way your web server works and ensure optimum website speed and resource utilization.

PHP configuration is usually done by an expert system administrator by tweaking settings defined in PHP.ini and .htaccess files within PHP installation of your server.

Configuring PHP settings can help you do the following:

  • Control PHP version: Depending on the compatibility of programs running on your web server, you can configure either PHP 5 or PHP 4.
  • Access control: You can configure PHP files to have access control of directories and upload of files through HTTP. You can also use these files to –
    • Define the maximum upload size for any file that needs to be placed on your web server.
    • Set read-only, read or write permissions for various users ranging from administrator to guests
  • Resource allocation: Resources of your web server are precious and have to be judiciously allocated across various programs resting on it. Based on the priority of operation, level of safety required, as well as to avoid server overload and lockups, it is essential to fine tune these settings. Through PHP configuration, you can easily define the following entities to ensure optimal server performance –
    • Memory utilization
    • Maximum execution time
    • Application time out duration

Through cPanel you can easily check the status of each of these settings, However to change the settings, you will need to have access to php.ini and .htaccess files on your server. For shared hosting accounts, the access is usually restricted to the hosting company, who may or may not change the settings on customer request. For dedicated servers, you have total control over these settings.