skip to Main Content

I needed to change few values in php.ini file and after running phpinfo() within my application, found my php.ini file in below location

Configuration File (php.ini) Path /opt/php-5.6.30/lib

Loaded Configuration File /opt/php-5.6.30/lib/php.ini

Changed the values in above php.ini file followed by apache2 restart but they didn’t reflect.

I ran php --ini command to see any other php.ini files and got following folders:

/etc/php/7.0/cli

/etc/php/7.0/apache2

/etc/php/7/0/fpm

so changed values in all of those php.ini files followed by apache2 and php7.0-fpm restart but to no effect.

I’m puzzled as my application’s "loaded configuration file" is using php 5.6.30 which is in /opt/php-5.6.30 folder without any apache2 folder within and php-fpm points at /etc/php/7.0 folder.

None of those ini files followed by apache & php-fpm service restarts is actually reflecting my changes.

Any suggestions/pointers would be much appreciated.

2

Answers


  1. I think the problem is that you are using different php versions for php-fpm (web), and cli. You should create test.php file, and run there phpinfo(). And check where loaded php.ini of web version is located. You should access test.php from web, like https://example.com/test.php

    Login or Signup to reply.
  2. If you’ve made changes to your php.ini file and the changes are not being reflected, even after restarting your server, there are a few things you can try:

    Check that you are editing the correct php.ini file: Make sure you are editing the correct php.ini file that your server is using. You can check which file your server is using by creating a PHP file with the following content:

    <?php
     phpinfo();
    ?>
    

    Save the file to your server and open it in your browser. Look for the "Loaded Configuration File" directive in the output to determine the location of the php.ini file.

    Check that you have permission to edit the php.ini file: Make sure that you have permission to edit the php.ini file. If you are not the owner of the file, you may need to use sudo to edit it.

    Check for syntax errors: Make sure that there are no syntax errors in your php.ini file. You can check for syntax errors by running the following command:

    php -c /path/to/php.ini -l
    

    Replace /path/to/php.ini with the actual path to your php.ini file. If there are syntax errors, you will need to correct them before the changes can take effect.

    Clear any opcode caches: If you have an opcode cache, such as APC or OPcache, you may need to clear it before the changes to the php.ini file take effect. You can usually clear the opcode cache by restarting your web server or by using the cache’s built-in function.

    Check that your changes are in the correct section: Make sure that your changes are in the correct section of the php.ini file. For example, if you are trying to change the max_execution_time directive, make sure that it is in the [PHP] section of the file.

    Restart your web server: Finally, make sure to restart your web server after making changes to the php.ini file. Depending on your server configuration, you may need to restart both the web server and the PHP FPM process.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search