Nginx – PHP-FPM Loading Wrong Configuration File

nginxPHPphp-fpmphp5

Value of CLI running php –ini

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

Value of phpinfo from my nginx/php-fpm web server page:

Loaded Configuration File   /etc/php.ini 

So my issue is that the web server php is not loading the MySQL extension causing MySQL not to work. The CLI php is though (proper php.ini is /usr/local/lib/php.ini).

Best Answer

Are they even the same versions? php -v on the command line and phpinfo via nginx?

You could look at doing a symlink from the /usr/local/lib/php.ini - if they are the same version. Backup the /etc/php.ini first of course, as there might be some memory / other settings you need to port over.

Edit;

Thinking about it. It sounds like /etc/php.ini is from a package but /usr/local/lib is from a custom install of PHP. You'd probably be better off to change nginx (check the configs) instead of a symblink.