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
Susan
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
gee12
March 9th, 2018 at 1:41 pm
Thanks!!