April 18, 2019

Adding PHP to Apache on Linux - page 8

Supercharging Your Web Pages

  • December 23, 1999
  • By Ken Coar

If you built PHP as a script interpreter, verify that it is working correctly by creating and executing a test script such as the following:

    % cat < script-test.php3
    > #!/usr/local/bin/php -q
    > EOP
    % chmod 755 script-test.php3
    % ./script-test.php3
    PHP script interpreter is OK!

The '-q' switch tells the interpreter to suppress the 'Content-type:�text/html' line it ordinarily prints by default (because it assumes it's being run as a CGI script).

If PHP was built as an Apache module, the simplest way to test it is to create a file in the DocumentRoot that contains this single line:


and then fetch it in a browser. It should display a long and detailed Web page describing the PHP module, the extensions that were included when it was built, and the Apache environment as well.

Most Popular LinuxPlanet Stories