Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to modify PHP settings in Ubuntu 14.04?

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 156
    Comment on it

    Modify PHP settings

    PHP settings can be changed and configured using php.ini file. This blog will give you few common examples.

    In PHP applications there are some case in which we might need to allow for larger upload files. Such as videos, plugins or large database files. In order to upload large amount of data into your PHP application you need to edit the php.ini file with the following command (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

    post_max_size = 8M
    upload_max_filesize = 2M

    You can change your desired maximum file upload size with these default values.  For example, if you needed to upload a 60MB file you would changes these lines to:

    php.ini

    post_max_size = 60M
    upload_max_filesize = 60M

    If you want to increase the amount of memory limit PHP can use, you can set by memory_limit:

    php.ini

    memory_limit = 128M

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

    php.ini

    max_execution_time = 30

    When php.ini is configured then you can save the changes and exit php.ini file

    Now restart the web server to enable the changes that you have just made. For Apache on Ubuntu 14.04, this command will restart the web server:

    sudo service apache2 restart

    Now create file info.php and write the following lines:

    <?php
    phpinfo();
    ?>

    Now refresh the page info.php and you will see the changes has been updated that you have made.

    Thanks for reading the blog.

 1 Comment(s)

  • 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

    The three files you have there are each meant for different uses.

    /etc/php5/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.

    /etc/php5/cgi/php.ini is for the php-cgi system which isn't specifically used in this setup.

    /etc/php5/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit for changes to be applied for your Apache setup.

    informatica training in chennai | aws training in chennai | hadoop training in chennai

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: