DeveloperSide.NET Forums
June 05, 2020, 03:30:12 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
Author Topic: Apache2 + PHP4 setup problem! Plz help!  (Read 12520 times)
0 Members and 1 Guest are viewing this topic.
« on: October 27, 2003, 01:13:22 AM »

My OS is Win2K.
httpd.conf is included follow:

DirectoryIndex index.php index.html index.html.var

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"

<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
Options Indexes FollowSymlinks MultiViews execCGI Includes SymLinksIfOwnerMatch

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php "C:/Program Files/Apache Group/PHP/php.exe"

 Please help!!

Error Log:

[error] [client xxx] C:/Program Files/Apache Group/Apache2/cgi-bin/hello.php is not executable; ensure interpreted scripts have "#!" first line
[error] [client xxx] (9)Bad file descriptor: don't know how to spawn child process: C:/Program Files/Apache Group/Apache2/cgi-bin/hello.php

extension_dir = "C:\Program FilesApache GroupPHPextensions"
doc_root = "C:Program FilesApache GroupApache2htdocs"

 Please help!!
« Reply #1 on: October 27, 2003, 05:08:40 AM »

Every CGI file needs to have a first line (shebang line) that points to the program that will execute that file.  So if your putting php files into /cgi-bin, every one of those files needs to have "#!C:/php/bin/php.exe" (or whatever the path is to php.exe) as the first line, without the "" (quotes).

Your php.ini doc_root does not seem to have any "\".

Your using directories that contain " " (spaces) in them.

Why not follow the instructions on ?
« Reply #2 on: October 27, 2003, 05:14:00 AM »

Actually, I think if you take out "execCGI" from Options, what you have might work without modifications.

I think the execCGI option looks for the "shebang" line and overides the AddType and Action directive you have.

If you choose to use the execCGI option, you will need to load mod_cgi.
« Reply #3 on: October 27, 2003, 07:11:38 AM »

Thanks for your reply.

After I follow the steps in,
it work.

But, I would like to run the PHP into the cgi-bin folder,
after I changed the php.ini,
doc_root = "C:/www/Apache2/htdocs/cgi-bin/".

The problem is 500 Internal Server Error. How can I change the PHP program in cgi-bin folder?

Thank you for your help.
« Reply #4 on: October 27, 2003, 05:36:39 PM »

So you also reinstalled Apache and/or updated httpd.conf with all new path values?

I mean, you are using different paths to Apache now...

Your PHP files should now be in your webroot(htdocs), not your cgi-bin directory.  Otherwise, it just does not make sense.  You are not using PHP as an executable anymore, your using it as an Apache loadable module.  Your *.php files get executed automatically upon request.

Also the doc_root in php.ini never points to the cgi-bin directory, only the webroot(htdoc).  Unless you do not have a webroot.  Which would never be the case.  You seem to be confused.
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!