Categories: Snippets

How To Change Your PHP Settings on Ubuntu 14.04 (Increase upload size in your php.ini)

You can review the live PHP configuration by placing a page with a phpinfo function along with your website files.

To create a file with this command, first change into the directory that contains your website files. For example, the default directory for webpage files for Apache on Ubuntu 14.04 is /var/www/html/:

cd /var/www/html

Then, create the info.php file:

sudo nano /var/www/html/info.php

Paste the following lines into this file and save it:

<?php
phpinfo();
?>

When visiting the info.php file on your web server (http://www.example.com/info.php) you will see a page that displays details on the PHP environment, OS version, paths, and values of configuration settings. The file to the right of the Loaded Configuration File line shows the proper file to edit in order to update your PHP settings.

This page can be used to reveal the current settings your web server is using. For example, using the Findfunction of your web browser, you can search for the settings named post_max_size and upload_max_filesize to see the current settings that restrict file upload sizes.

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

In this we need to change values of

memory_limit 256M
post_max_size 256M
upload_max_filesize 64M
max_input_vars 1800
max_execution_time 300
max_input_time 300

restart 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.

Recent Posts

How To Troubleshoot Socket Errors in MySQL – Ubuntu

MySQL manages connections to the database server through the use of a socket file, a special…

5 years ago

How to remove .html, .php, etc (extension) from URL?

To remove the .html extension from your urls, you can use the following code in…

5 years ago

Ubuntu with Apache2: Installing and Configuring Your SSL Certificate

Use free/paid SSL certificates https://www.sslforfree.com Enable SSL Module Replace 'default-ssl' with the real site name…

5 years ago

Create zip archive excluding specific Files & Directories

Create archive of all files under public_html directory ignoring all files and folders including text…

5 years ago

how to use sudo command to install .tar.gz?

To install some file *.tar.gz, you basically would do: Open a console, and go to…

6 years ago

Change ownership of the directory in ubuntu

The chown command has the following syntax: [crayon-662ce76d85ef9190964433/] So in your example command it is your primary…

6 years ago