Modifying the PHP Configuration php.ini

Modifying the PHP Configuration

The php.ini file can be edited to change the settings and configuration of how PHP functions. This section gives a few common examples.

Sometimes a PHP application might need to allow for larger upload files such as uploading themes and plugins on a WordPress site. To allow larger uploads for your PHP application, edit the php.ini file with the following command (Change the path and file to match your Loaded Configuration File. This example shows the path for Apache on Ubuntu 14.04.):

  • sudo nano /etc/php5/apache2/php.ini

The default lines that control the file size upload are:

php.ini

Change these default values to your desired maximum file upload size. For example, if you needed to upload a 30MB file you would changes these lines to:

php.ini

Other common resource settings include the amount of memory PHP can use as set by memory_limit:

php.ini

or max_execution_time, which defines how many seconds a PHP process can run for:

php.ini

When you have the php.ini file configured for your needs, save the changes, and exit the text editor.

Restart the web server to enable the changes. For Apache on Ubuntu 14.04, this command will restart the web server:

  • sudo service apache2 restart

Refreshing the info.php page should now show your updated settings. Remember to remove the info.php when you are done changing your PHP configuration.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">