[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


PHP Not loading php.ini file?

Posted on 2006-04-05
Medium Priority
Last Modified: 2012-08-14
I'm running PHP 5.1.0 under Apache on a Linux box.  When I run phpinfo(), it tells me that the location of my php.ini file is at "/export/software/minerva/php/lib".  Originally, there was no file there, so I put a copy of the distribution one there and restarted apache.  This had no effect.  None of the configuration changes that I make to this php.ini file are ever reflected when I phpinfo().  I've subsequently tried placing copies of my modified php.ini file in the local directory that I execute phpinfo() out of, in the root directory of php, and in the root directory of apache and htdocs--still, nothing happens.  PHP seems unwilling to load the php.ini file.

One note that might be related is that whenever I restart apahce, I get the following error:

[warn] module mod_php5.c is already added, skipping

All I can think of to try at this point is to completely unistall and reinstall everything, which I'm not anxious to do as this is a production server.  I'm hoping someone will have seen this before and might be able to help.
Question by:wizcarl
  • 4
  • 2

Expert Comment

ID: 16381170
Haven't done a compile of PHP for quite a while however the location of where the php.ini is kept is one of the options in the ./configure script
check out the config file in that directory or do a ./configure --help in the build directory
or you could try the old standard places like /etc/php.ini or maybe /usr/local/etc/php.ini
Some distros do some wierd stuff and stick some things in weird places you could do a
locate php.ini and see what you find
or maybe there is something /usr/share/docs


Author Comment

ID: 16381336
This isn't the problem. As I've already stated, the php configuration says that it is looking in "/export/software/minerva/php/lib" for the php.ini file, but it doesn't process the file here, or anywhere else.  Its my understanding that PHP shoul load the file at the configured location as the default, but should also load a local php.ini file in any script directory as a local override.  In my case, it won't load a php.ini file from anyewhere, even the directory that it is configured to look in.

Expert Comment

ID: 16381408
That may be true but these things may not be enabled in the configuration.

Also can apache get to this directory and read it.
Also apache may be blocking reading the local php.ini file maybe AllowOverride in the httpd.conf or where ever you distro does it

Did you complie it or is it a distro version if so which distro and where are the docs for php
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 16381793
AllowOverride is enabled and and Apache can read the php.ini directory and read it.  PHP was compiled on the server, although I didn't do it.

Expert Comment

ID: 16381801
[warn] module mod_php5.c is already added, skipping
Also this warning is basically Apache saying that it's module loading procedure is called twice on the same file
This should not create the php.ini issues you speek of
you will need to work out how the modules are loaded in your vaersion of apache
grep -r mod_php5 /etc/httpd/*
find where it is added twice


Accepted Solution

spotx earned 1500 total points
ID: 16382343
As far as the php.ini issue you will need to check out the build process
I would try and run ./configure with the parameters that were set in the the original and change the php.ini location to a simpler one ie: /etc/php.ini
phpinfo() should give you an idea of what the configure parameters were.
just re-running ./configure may help if it throws any errors
This looks like it will require a methodical approach to step by step find whats wrong

did you try
su apache -c '/bin/cat /export/software/minerva/php/lib/php.ini'


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question