note 19949 deleted from install.commandline by sniper
| From: | sniper@php.net | Date: | Thu, 05 Jun 2003 05:14:52 +0000 |
| Subject: | note 19949 deleted from install.commandline by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49761@lists.php.net to get a copy of this message | ||
Note Submitter: vke@onebox.com
----
After spending some time trying to compile php4.1.2 from source as a cgi executable with apache
1.3.20 on red hat linux 7.2
Some of the things that i understood:
A. After installing php there are two ways to execute the php scripts.
1. for each php script the first line has to be
#! /path/to/phpexecutable
and put the phpscript in apaches cgi-bin directory which for me was
/var/cgi-bin/test.php
B. tell apache through its configuration file httpd.conf in some way to transfer all .php or .php4
files to the php binary this can be done in the following way
1. In httpd.conf add
i.AddType application/x-httpd-php .php4
ii.ScriptAlias /php4/ "/home/king/php-4.1.2/"
iii.Action application/x-httpd-php /php4/php
some points to take special care of:
i. The .php or .php4 file can not reside in the apache's cgi-bin directory as apache assumes
that it is a cgi file and therby gives the following error:
[Sat Mar 16 16:31:30 2002] [error] (8)Exec format error: exec of /var/www/cgi-bin/test.php4 failed
[Sat Mar 16 16:31:30 2002] [error] [client 192.168.7.5] Premature end of script headers:
/var/www/cgi-bin/test.php4
ii. in apache httpd.conf we have to use the ScriptAlias Directive we cannnot give the complete path
in the action directive by saying something like:
Action application/x-httpd-php /home/king/php-4.1.2/php
This will result in a error:
File not found in your browser when u try to execute the php script from the browser.
On examining error_log of apache in the directory /var/log/httpd we come to know that the error is:
The webserver is trying to look for the file x.php in the directory
/var/www/html/home/king/php-4.1.2/php/x.php
Hope this helps,
Vikas