Click to See Complete Forum and Search --> : PHP on APACHE for WIN - Bad Request


Anon
06-26-2002, 10:37 AM
Before I start i just want to let you know that I DO know a great deal about computers and programming but have absolutely NO idea what I am doing when installing Web Servers or SDK's. Ok here goes,

I have recently installed Apache 1.3.26 on my Windows ME 4.90.3000 machine. As far as i can tell it runs fine. There are no errors at startup and i can see the Apache Success Page when i visit http://localhost/ in my web browser(IE 6.0). My intention was to install Perl and PHP onto the server but i cant get either of the to work.

Lets start with the Perl. I have installed Perl for Windows in the directory mentioned at the bottom of this post. I have added the following lines in this order to the httpd.conf file in the apache/conf directory...

> AddModule mod_cgi.c
>
> ScriptAlias /cgi-bin/ "C:/SERVER/Apache/cgi-bin/"
>
> <Directory "C:/SERVER/Apache/cgi-bin">
> AllowOverride None
> Options None
> Order allow,deny
> Allow from all
> </Directory>
>
> AddHandler cgi-script .cgi

So my .cgi files are in the cgi-bin dir but when i come to run them i get the "500 Server Error" error and the script doesnt run. If i have missed anything out of the httpd.conf please tell me. If it is all correct the i suspect a CHMOD error and i would be happy if someone could tell me how to perform a CHMOD because i have no idea.

Now for the PHP,
I have PHP installed in the directory given at the bottom of this post. My install of PHP does not contain any of the API versions of PHP. I have added the following lines to the httpd.conf file...

> ScriptAlias /php/ "C:/SERVER/Apache/htdocs/"
>
>AddType application/x-httpd-php .php
>Action application/x-httpd-php "C:/SERVER/PHP/php.exe"

Again, if i have made any mistakes or ommitions in this please tell me. When i try to run a php file in the directory htdocs i get the error "Bad Request"

My install directories are below...

My Server Parts DIR (Apache, Perl, PHP)
C:/SERVER/

Path to Apache
C:/SERVER/APACHE/

Path to Perl
C:/SERVER/PERL/

Path to PHP
C:/SERVER/PHP/

Path to MySQL
C:/SERVER/MySQL/

If you need any more information please ask
Thanks For You Help
Skripty

Anon
06-26-2002, 11:29 AM
I can't help you with Perl, but with PHP here's what I added to the end of my httpd.conf

ScriptAlias /php4/ "i:/httpd/php/"
Action application/x-httpd-php4 "/php4/php.exe"
AddType application/x-httpd-php4 .php .php3 .phtml .phps

i have php installed in i:\httpd\php so you'll need to change that line.

also check you php install. i move php.ini into c:\winnt and also the required dlls.

you can run php on the command line. while in the php directory type
php.exe test.php

where test.php contains
<?php php_info() ?>

and see if it works or gives you an error message. then try calling that file via you webserver and see what all the html actually looks like.

- Mike :-)

Anon
06-26-2002, 12:49 PM
Ok i have tried that and i get the following error message

Bad Request
Your browser sent a request that this server could not understand.
Invalid URI in request GET /index.php HTTP/1.1

what dll's should i have? i am not sure if i have them all!

It works fine in a DOS window

All i need now is a little help getting it to work in the browser.

Thanks for your help
skripty

Anon
06-26-2002, 02:25 PM
Please can someone help. I have been trying all day and i cant see what is wrong!

Thanks Mike, i now know i have the correct lines in httpd.conf but it still wont work. Status is same as my previous post.

skripty

Anon
06-26-2002, 07:13 PM
For the perl side you will have to change your default cgi file-type action to Run with "C:\Perl\bin\perl.exe" "%1" %* in the Application used to perform action box (change C:\Perl\bin\ to wherever you installed perl to). Windows doesn't know what it is supposed to do with the cgi file until you force it to run it. As for the PHP issue, I would suggest downloading the php4 zip from www.php.net and extracting that to whatever directory you want then follow the instructions in install.txt to use PHP as a module.

Anon
06-26-2002, 11:09 PM
Visit the page:
www.geocities.com/akindele/ and read the topic Configuring CGI on Apache for Win32.

Richie.

Anon
06-27-2002, 10:51 AM
I downloaded the zip from www.php.net AND followed the instructions given, but i just get the bad request - server couldnt understand the request. As for the CGI i will try that now.

If you have any other ideas i will be listening.

thanks
skripty