0

I'm trying to adjust max_execution_time and memory_limit directives.

phpinfo() output:

Server API  FPM/FastCGI Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php/7.0/fpm Loaded
Configuration File  /etc/php/7.0/fpm/php.ini 
Scan this dir for additional .ini files /etc/php/7.0/fpm/conf.d

I have updated both directives in

/etc/php/7.0/fpm/php.ini

and restarted apache2 but no luck.

php -r 'print php_ini_loaded_file(); print_r(php_ini_scanned_files());' output:

/etc/php/7.0/cli/php.ini/
/etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/15-xml.ini,
/etc/php/7.0/cli/conf.d/20-apcu.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
/etc/php/7.0/cli/conf.d/20-curl.ini,
/etc/php/7.0/cli/conf.d/20-dom.ini,
/etc/php/7.0/cli/conf.d/20-exif.ini,
/etc/php/7.0/cli/conf.d/20-fileinfo.ini,
/etc/php/7.0/cli/conf.d/20-ftp.ini,
/etc/php/7.0/cli/conf.d/20-gd.ini,
/etc/php/7.0/cli/conf.d/20-gettext.ini,
/etc/php/7.0/cli/conf.d/20-iconv.ini,
/etc/php/7.0/cli/conf.d/20-imagick.ini,
/etc/php/7.0/cli/conf.d/20-imap.ini,
/etc/php/7.0/cli/conf.d/20-intl.ini,
/etc/php/7.0/cli/conf.d/20-json.ini,
/etc/php/7.0/cli/conf.d/20-mbstring.ini,
/etc/php/7.0/cli/conf.d/20-mcrypt.ini,
/etc/php/7.0/cli/conf.d/20-memcache.ini,
/etc/php/7.0/cli/conf.d/20-mysqli.ini,
/etc/php/7.0/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.0/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.0/cli/conf.d/20-phar.ini,
/etc/php/7.0/cli/conf.d/20-posix.ini,
/etc/php/7.0/cli/conf.d/20-pspell.ini,
/etc/php/7.0/cli/conf.d/20-readline.ini,
/etc/php/7.0/cli/conf.d/20-recode.ini,
/etc/php/7.0/cli/conf.d/20-shmop.ini,
/etc/php/7.0/cli/conf.d/20-simplexml.ini,
/etc/php/7.0/cli/conf.d/20-sockets.ini,
/etc/php/7.0/cli/conf.d/20-sqlite3.ini,
/etc/php/7.0/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.0/cli/conf.d/20-sysvsem.ini,
/etc/php/7.0/cli/conf.d/20-sysvshm.ini,
/etc/php/7.0/cli/conf.d/20-tidy.ini,
/etc/php/7.0/cli/conf.d/20-tokenizer.ini,
/etc/php/7.0/cli/conf.d/20-wddx.ini,
/etc/php/7.0/cli/conf.d/20-xmlreader.ini,
/etc/php/7.0/cli/conf.d/20-xmlrpc.ini,
/etc/php/7.0/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.0/cli/conf.d/20-xsl.ini,
/etc/php/7.0/cli/conf.d/20-zip.ini

php --ini ouput:

Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File:         /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
Additional .ini files parsed:      /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,

I have updated both directives in

/etc/php/7.0/cli/php.ini/

and restared apache2 but again no luck.

find / -type f -name "php.ini" ouput:

/etc/php/7.0/cli/php.ini
/etc/php/7.0/cgi/php.ini
/etc/php/7.0/fpm/php.ini
/etc/php/7.0/apache2/php.ini

Again, I have updated both directives in all *.php.ini files and restarted apache2 but still phpinfo() displays old settings.

Any ideas what I'm doing wrong here?

  • Did you restart php (php-fpm) ? – Gerard H. Pille Mar 6 at 16:21
  • I forgot about it! Haha, thank you very much @Gerard H. Pille :) Please post this as answer and I will mark this as solved. – Kris Mar 6 at 16:26
0

Php-fpm runs independently from Apache, so it needs a reload or restart to see the new directives. ;-)

| improve this answer | |
0

Based on the configuration layout this seems a Debian based system.

For each major.minor release M.N of PHP (where M is 7 and N is 0, 1, ...), each of the SAPI's (apache2/cgi/fpm/cli/phpdbg/...) have a different central configuration file /etc/php/M.N/$SAPI/php.ini

Based on the output of phpinfo() Apache is using the PHP FPM/FastCGI as the Server Application Programming Interface (SAPI). Therefore, the configuration files in /etc/php/7.0/fpm/ are used. Reloading the configuration requires reloading the PHP-FPM (separate from Apache):

sudo systemctl reload php7.0-fpm

When you use PHP from the command line, CLI SAPI is used, instead, so /etc/php/7.0/cli/ is in use. The PHP CLI reads the configuration when you launch the command. That's why the commands you used for testing gave conflicting results.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.