3

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?

Liam
  • 1,343
  • 3
  • 17
  • 28

1 Answers1

2

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.

Greg
  • 1,353
  • 1
  • 12
  • 13
  • 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
  • BEWARE: Removing the RPM will probably restart apache automatically. RPM has options like --noscripts and --notriggerpostun, but without reading through the actual CentOS4 php scripts, and without having a copy of CentOS4 handy, I couldn't tell you whether the script will restart httpd. – Greg Apr 21 '11 at 19:25