How do I enable PHP apache_request_headers() or change PHP into an apache module

9,506

The Apache functions are only available if running the httpd SAPI, also known as mod_php.

The stock CentOS PHP packages make mod_php available, so they are enough to allow them. If you need a newer version than the stock packages then you will need to find newer packages somewhere, or you will need to build PHP or the PHP packages yourself with the proper SAPI.

Share:
9,506

Related videos on Youtube

inac
Author by

inac

Updated on September 17, 2022

Comments

  • inac
    inac over 1 year

    PHP, WHM, and several other services are already installed on a CentOS x64 server I am trying to migrate data to. Many of my existing PHP scripts are dependent on PHP's apache_request_headers() function, which the current server's PHP configuration does not support. Apparently, compiling PHP as an Apache module is one solution, but are there other ways to enable this (without uninstalling PHP, reinstalling, etc., and all dependent services), perhaps as easy as modifying php.ini, somehow?

    • skarap
      skarap about 11 years
      Won't yum install php help?
    • pqnet
      pqnet over 9 years
      please add version information for php apache and centos if possible
  • inac
    inac almost 14 years
    How do you enable mod_php on a stock CentOS install?
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams almost 14 years
    Installing the php package will install mod_php and pull in the httpd package as well. The default configurations for the two, when installed together, enables mod_php.
  • inac
    inac almost 14 years
    PHP has already been installed - any advice on the best process to uninstall PHP and reinstall, especially if there are other services preinstalled that may depend on PHP. (The server is not yet live, still configuring it.)
  • inac
    inac almost 14 years
    PHP has already been installed - any advice on the best process to uninstall PHP and reinstall, especially if there are other services preinstalled that may depend on PHP. (The server is not yet live, still configuring it.)
  • Beel
    Beel almost 14 years
    These steps (6, 7, 8 ...) address the part of the question where you asked "change PHP into an apache module". Are you focusing on only uninstall/reinstall now?
  • inac
    inac almost 14 years
    I'm trying to work this with the existing install, but after going through 6,7,8 (in 8, skipping "mod_rewrite may be used To allow any arbitrary .php file to be displayed as syntax-highlighted source code, without having to rename or copy it to a .phps file"), my .php / .phps files become interpreted as file downloads, rather than being displayed in the browser.
  • skarap
    skarap about 11 years
    I'm guessing you have compiled php from sources, right? You can try to make uninstall, but I'm not sure it will work. If starting from scratch is an option, I'd go with it.