PHP Not loading php.ini file?

Posted on 2006-04-05
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
    LVL 3

    Expert Comment

    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

    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.
    LVL 3

    Expert Comment

    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

    Author Comment

    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.
    LVL 3

    Expert Comment

    [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

    LVL 3

    Accepted Solution

    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'


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now