Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a strange issue I can’t seem to figure and googled and researched a lot to no end.

I’ve got php-fastcgi via spawn-fcgi running fine on nginx (cent os 5). However, I’m trying to load memcache and mongo php extensions and for some reason nginx skips right over their ini files in /etc/php.d/. I know memcache and mongo extensions are installed correctly because my apache instance on the same box loads them fine. I’m thinking maybe I need to build php from source and specifically include them in the ./configure .. just a bit gun shy to do this because I’m not sure how this will impact the installation since I installed everything from yum.

Finally, all permissions check out and I've even tried putting the extensions directly into /etc/php.ini without success and the issue persists.

Just wanted to also add that simply restarting the nginx service to load the modules (as is required) wasn't enough.

Here is what phpinfo() on NGINX shows:

Configuration File (php.ini) Path: /etc/php.ini

Scan this dir for additional .ini files: /etc/php.d

additional .ini files parsed: /etc/php.d/dbase.ini, /etc/php.d/dom.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini

Here is what phpinfo() on Apache shows:

Configuration File (php.ini) Path: /etc/php.ini

Scan this dir for additional .ini files: /etc/php.d

additional .ini files parsed: /etc/php.d/dbase.ini, /etc/php.d/dom.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/memcache.ini, /etc/php.d/mongo.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini

..notice apache loaded memcache.ini and mongo.ini and nginx didn't. What could be wrong?

share|improve this question
    
Nginx has nothing to do with this, you're looking in the wrong place if you're looking at nginx. –  Martin Fjordvald May 6 '11 at 20:29
    
Martin, could you elaborate a little or do you have any suggestions as to what it could be? It's a very peculiar problem and I've exhausted all my resources to resolve this.. –  Mike May 6 '11 at 23:16
    
Nginx does not interact with PHP outside of the fastcgi protocol. It does not embed PHP like Apache does and as thus can only manipulate it in ways allowed by the fastcgi specification. Whether to load modules like memcached is not something Nginx can affect. –  Martin Fjordvald May 7 '11 at 2:13
    
I see your point. Digging deeper into why php run as fastcgi isn't loading these modules is probably the more appropriate investigation I need to conduct. –  Mike May 8 '11 at 14:52

3 Answers 3

Create a new phpinfo() file, run it on both Apache and Nginx and check for "Loaded Configuration File", "Additional .ini files parsed", "Scan this dir for additional .ini files", etc.

If the paths are different you should examine the differences between those files and modify the one that nginx use.

example phpinfo() file:

<?php
phpinfo();
?>
share|improve this answer
    
Viktor, everything you suggested was part of the first things I did. Apache and NGINX share the same locations for php.ini, dir for additional .ini files, and modules to load. Above you can see I've listed the additional .ini files parsed by php on nginx. I'll post an edit to show what php on nginx loads and what php on apache loads. –  Mike May 7 '11 at 1:15

If you are using fast-cgi then make sure you restart it.

share|improve this answer

I ran into this too. Spock is right - restart nginx's connection to PHP. I'm using PHP-FPM so it would be: /etc/init.d/php5-fpm restart in my case

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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