Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, Please I need Help configuring PHP on a Apache WebServer

Status
Not open for further replies.

ejgarcia

IS-IT--Management
May 28, 2003
72
US
Hello, Please I need Help configuring PHP on a Apache WebServer.

I already installed Apache 2.0.48 and PHP 4.3.4 in a Windows XP environment. Also I configured all entries: ScriptAlias, AddType and Action and when I try to run a simple php Script it shows me at the apache log, the following error:

[Mon Dec 08 19:09:24 2003] [error] [client 127.0.0.1] C:/PHP4.3.4/prueba.php is not executable; ensure interpreted scripts have "#!" first line
[Mon Dec 08 19:09:24 2003] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/PHP4.3.4/prueba.php

Thanks all,
 
Sounds to me like PHP is running as a CGI.

It also sounds to me like Apache is expecting to find a unix-style shebang line at the beginning of the file.

Since unix-like OSes have a lot more options for scripting than just command.com, the first line of a script defines the location of the script interpreter. On Win32, I guess it'll be a line like:

#! c:\path\to\the\PHP\interpreter.exe

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Go to and you can download a file foxserv 3.0 that will install Apache/PHP and MySQL for you.

It is not the absolute latest versions of each but they are recent versions
 
Hello sleipnir214,

Please I'm beginner in this fact. Please would you be a little more specific?

Thanks you,
 
Hello likelylad,

Thanks you for the foxserv, but I wanted to install by myself to learn.

Regards,
 
Like I said, Apache is complaining that it does not know how to run your PHP script. It is specifically asking for a shebang line (which I have described above).

Figure out where your PHP interpreter is installed on your filesystem. Edit your script so that you have a shebang line that points to the PHP interpreter.

Again, if the PHP executable is at c:\php\php.exe, then a script should read something like:

#! c:\php\php.exe
<?php
print 'foo';
?>



Want the best answers? Ask the best questions: TANSTAAFL!!
 
Maybe if you install foxserv and see how it is configured. You might see what you are doing wrong.
Then do a fresh install to see if you can do it manually


 
Your problem might be the one I strugged with and couldn't find an answer for. I had the same problem and PHP was running as a module, not CGI. The issue is this:

ScriptAlias appears to only apply to CGI. If you're running PHP as a module in Apache, then set ScriptAlias to a folder that you will not be hosting your .php files from. I use CGI applications as well so I set ScriptAlias to /cgi-bin/ &quot;D:/webroot/cgi-bin&quot; and I also use a folder called &quot;scripts&quot; in the webroot directory as well for my php files. Everything works fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top