Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add MySQL support to my PHP installation on RHEL4. I need to rebuild PHP from source due to other extensions that are required. Will Apache be down for a few seconds when I restart it, or will I need to stop it while I install PHP?

share|improve this question
up vote 2 down vote accepted

It depends on whether you are using mod_php or php cgi. Mod_php is loaded into memory when apache starts, so you can install php without affecting it. The new mod_php module will be loaded when you restart apache.

PHP CGI on the other hand gets loaded every time a script runs. If you are installing PHP to a new location, that's fine, because apache will only look for the new location when it is restarted and finds the new location in its config file. However, if you are using PHP CGI and installing php over an existing installation, you will have to bring down apache while that happens.

share|improve this answer
How do I tell which I am using? – Liam Apr 21 '11 at 15:34
@Liam, you can determine this by checking the output of phpinfo(). – Brad Apr 21 '11 at 15:48
Does this mean I am using mod_php? Server API = Apache 2.0 Handler – Liam Apr 21 '11 at 15:54
Yes - and you only need to bounce Apache once after you've installed the new PHP code - note if your current install is via RPM, then I would recommend uninstalling the RPM before you install (but after compiling) from tarball (apache will continue to run with the old PHP in memory). Note that removing the PHP RPM will strip out the PHP config from Apache - but you'll need to change this anyway for the new paths to PHP stuff – symcbean Apr 21 '11 at 16:59
Great advice, thanks everyone! – Liam Apr 21 '11 at 17:08

Your Answer


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.