mahbad mahbad - 2 years ago 156
Apache Configuration Question

PHP - - ini "(none)" and not loading extensions

So I ran into something I'm just hoping I can get some understanding on. There is a clean Centos machine with a clean install of PHP. It had the mongoDB driver installed as well. When accessing the web app through the browser, it kept complaining the mongo client didn't exist. All of the installation procedures were followed,

, and httpd restarted. PHP
did not contain the Mongo conf. What ended up working was adding a
file to the
directory with the
written to it.

I'm getting a sneaky suspicion
wasn't being loaded correctly, but I don't understand why. The reason I'm thinking this is, for one, it worked after adding
. Second, there are mismatched PHP
outputs from the CLI and browser gui.

cli output

and from the GUI

gui output

Both of these were snapped seconds apart. No configuration changes or restarts were made. For some reason the CLI output says the loaded configuration file was
which was expected. The browser GUI however shows
. What is going on here? Is this why the
was never loading from the


CentOS Linux release 7.3.1611

[someUser@someServer etc]# find / -name php.ini

Is SO even the proper place for this? or should I move to a different forum?


After reading Grigory Ilizirov's comments, and doing some research, I think the question is answered if he wants to post it. Looks like the php configs for apache wasn't being loaded. I had just assumed the
file was all that was needed to be edited. Now I just need to figure out how the heck I'm going to do that.

update 2

Reverted back to a clean install and did everything again. This time around, same results from the CLI and web GUI as before, but now mongo wouldn't load at all despite being added in
. suspect SELinux is interferring with apache.
is no longer showing in the additional .ini file sections. Disabling SELinux and rebooting allows it to load to apache.


This is indeed an SELinux issue. Now then, does this belong on SO for future users?

Answer Source

It was indeed SELinux interfering with Apache's access to the PHP configuration file. Adding the security context fixed it.

semanage fcontext -at httpd_sys_content_t '/etc/php.ini'
semanage fcontext -at httpd_sys_content_t '/etc/php.d/(/.*)?'
restorecon -Rv /etc/
systemctl restart httpd

apache found the config file

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download