Software Developer

Set php.ini To Development Mode in Ubuntu 16.04, For PHP 5.6 and PHP 7

For PHP 5.6

Make a backup copy of your current php.ini. Open a terminal and enter the following.

sudo mv /etc/php/5.6/apache2/php.ini /etc/php/5.6/apache2/php.ini.back

The php.ini-development file for PHP 5.6 on Ubuntu 16.04 is located in

/usr/lib/php/5.6/php.ini-development

First, check to make sure that the php.ini-development file is at this location. Open the file:

gedit /usr/lib/php/5.6/php.ini-development

Replace gedit above with your text editor. For example, nano or leafpad or subl.

The file that opens should begin with something like this:

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

If it’s blank, then the file is not there. In this case, use this to find the location of your php.ini-development file:

sudo find / -type f -name "php.ini-development"

Use this location to replace the /usr/lib/php/5.6/php.ini-development in the next command.

Next, copy the php.ini-development file over to php.ini

sudo cp /usr/lib/php/5.6/php.ini-development /etc/php/5.6/apache2/php.ini

Restart the server:

sudo service apache2 restart

For PHP 7

Make a backup copy of your current php.ini. Open a terminal and enter the following.

sudo mv /etc/php/7.0/apache2/php.ini /etc/php/7.0/apache2/php.ini.back

The php.ini-development file for PHP 7 on Ubuntu 16.04 is located in

/usr/lib/php/7.0/php.ini-development

First, check to make sure that the php.ini-development file is at this location. Open the file:

gedit /usr/lib/php/7.0/php.ini-development

Replace gedit above with your text editor. For example, nano or leafpad or subl.

The file that opens should begin with something like this:

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

If it’s blank, then the file is not there. In this case, use this to find the location of your php.ini-development file:

sudo find / -type f -name "php.ini-development"

Use this location to replace the /usr/lib/php/7.0/php.ini-development in the next command.

Next, copy the php.ini-development file over to php.ini

sudo cp /usr/lib/php/7.0/php.ini-development /etc/php/7.0/apache2/php.ini

Restart the server:

sudo service apache2 restart

See more: ,

By

We've 2 Responses

  1. October 9th, 2017 at 12:03 am

    I’m a new Ubuntu user and I’ve spent a lot of time trying to get my php errors to show up – didn’t realize there were multiple places for the ini files to hide!

    Thanks for this simple explanation and step by step instructions.

    Susan
    lilaavenue.com

    avatar

Leave a Reply to Susan Cancel reply

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]