In some cases, you might have two PHP configuration files: one for the PHP command line and for the web server. If so, make the change in both php.ini files.
Open any text editor of you choice like Gedit and Copy/Paste the following PHP code and Save the file as 'info.php' inside the Document Root folder of your Web Server. Usually the path to your Document Root should be something like '/var/www/html/'. Make sure to save your file under the 'html' folder.
Now access this file from a browser using the following URL: http://localhost/info.php
You should be seeing a page open as shown in the image below. The path to your 'php.ini' file will be under Loaded Configuration File. In my case the path was as follows: Loaded Configuration File /etc/php/5.6/apache2/php.ini
Open your Terminal (CTRL+ALT+T) and enter the following command:
You should get output as shown in the image below. Here too you should be looking for the Loaded Configuration File path. In my case it was /etc/php/5.6/cli/php.ini.
1. To Edit web server's php.ini file
Open any text editor of you choice like Gedit and Copy/Paste the following PHP code and Save the file as 'info.php' inside the Document Root folder of your Web Server. Usually the path to your Document Root should be something like '/var/www/html/'. Make sure to save your file under the 'html' folder.
<?php
phpinfo();
?>
Now access this file from a browser using the following URL: http://localhost/info.php
You should be seeing a page open as shown in the image below. The path to your 'php.ini' file will be under Loaded Configuration File. In my case the path was as follows: Loaded Configuration File /etc/php/5.6/apache2/php.ini
Click on image to enlarge |
2. To Edit CLI's 'php.ini' file
Open your Terminal (CTRL+ALT+T) and enter the following command:
php --ini
You should get output as shown in the image below. Here too you should be looking for the Loaded Configuration File path. In my case it was /etc/php/5.6/cli/php.ini.
Click on image to enlarge |
Thanks
ReplyDelete