Adding PHP to Apache on Linux
Testing Your Installation

Ken Coar
Thursday, December 23, 1999 07:46:09 AM
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 <<EOP > script-test.php3
> #!/usr/local/bin/php -q
> <? echo "PHP script interpreter is OK!\n"; ?>
> 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:
<? phpinfo(); ?>
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.
Next: Going Further/In Conclusion »