2

I have a lot of differences between what is shown on console via php -i, and what is shown by apache via phpinfo().

For instance:

  • pdo_mysql exists for the first case, not for the second one.
  • include directive works only for the first case.

PHP.INI file is the same:

Console php -i:

Configuration File (php.ini) Path => /usr/local/etc/php/7.1

Loaded Configuration File => /usr/local/etc/php/7.1/php.ini

Scan this dir for additional .ini files => /usr/local/etc/php/7.1/conf.d

Additional .ini files parsed => /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini

PDO drivers => mysql, odbc, sqlite

VS Web phpinfo():

Configuration File (php.ini) Path /usr/local/lib

Loaded Configuration File /usr/local/etc/php/7.1/php.ini

Scan this dir for additional .ini files (none)

Additional .ini files parsed (none)

PDO drivers sqlite


For additional info, here is my apache configuration:

LoadModule php7_module /usr/libexec/apache2/libphp7.so

PHPINIDir /usr/local/etc/php/7.1/

AddHandler application/x-httpd-php .php

And include directive in /usr/local/etc/php/7.1/php.ini

include=/usr/local/etc/php/7.1/conf.d/*.ini

I restarted apache after every php.ini modification.


Any idea, any clue?

4
  • 2
    because some servers use a cli-php.ini file for command line. In other words you may have separate config files one for Apache one for the Command line. Commented Aug 8, 2017 at 1:02
  • @ArtisticPhoenix as you can see in the data given, it doesn't seem so. Loaded php.ini is the same. Commented Aug 8, 2017 at 1:05
  • But in the second your missing this additional one, ext-xdebug.ini Commented Aug 8, 2017 at 1:06
  • @ArtisticPhoenix you're right, that's one of the reasons why I created this thread... Commented Aug 8, 2017 at 1:07

1 Answer 1

1

Solved, whereas php.ini was the same, there were 2 different PHP7 builds running on CLI and Apache. Tricky but solved!

Sign up to request clarification or add additional context in comments.

6 Comments

Either by uninstalling all PHP instances and reinstalling just one, or by ensuring that your PHP Apache module (LoadModule php7_module [dir]/libphp7.so) points to to the same PHP as your command line PHP (which php)
In my case I reinstalled everything with homebrew (OSX)
How did you found there were 2 different builds?
@EAmez phpinfo() from webpage and command line gave different build numbers.
@mario check the LoadModule directive, it's either in httpd.conf or something like /etc/apache/modules/php7_module.conf
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.