Author |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Thu 16 Nov '06 23:15 Post subject: Apache 2.2.3 and PHP5 - Cannot find server error |
|
|
Hi. I have installed Apache 2.2.3 and PHP 5.2 (as a CGI) onto a WinXP Pro SP2 machine. Apache seems to work perfectly without PHP5.2.
Even with PHP5.2 installed with it, Apache works fine when serving any document. The problem arises when I request a .php file from the server. It automatically just gives a Cannot Find Server error.
I have looked at and reinsatlled both Apache and PHP5 according to:
http://www.apachelounge.com/viewtopic.php?t=570
but still with no luck whats so ever. If anyone can help me, I would be extremely grateful. Thanks. |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Thu 16 Nov '06 23:58 Post subject: |
|
|
Since you are running PHP as CGI, do you have the following:
Code: |
ScriptAlias /php/ "c:/php5/"
AddHandler application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe" |
and set permissions in Apache like:
Code: | <Directory "c:/php5">
Options FollowSymLinks
Allow from localhost
Order allow,deny
AllowOverride None
</Directory> |
or something close?
Also, you say you are followed my 'how to', does your CONF file currently contain:
Code: | LoadModule php5_module "C:/php5/php5apache2_2.dll"
PHPIniDir "C:/php5"
AddHandler application/x-httpd-php .php |
if so, you need to remove those three line as they only pertain to running PHP as an Apache module and NOT CGI.
Next, can the OS find your PHP installation, in other words, did you append the PATH in your System Environment with the path to PHP?
Finally, if you are still having problems, then post ONLY pertinent sections of your Apache CONF (your directives to load PHP and to set Apache permissions on your PHP installation - if still using PHP as CGI) so we can look at what you have going on. |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 0:07 Post subject: |
|
|
I have these lines to load as a CGI. I dont have the LOadModule things in there.
Code: | ScriptAlias /php/ "C:/WWW/PHP/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/PHP/php-cgi.exe" |
I also have tried the following with no luck:
Code: | ScriptAlias /php/ "C:/WWW/PHP/"
AddHandler application/x-httpd-php .php
Action application/x-httpd-php "/PHP/php-cgi.exe" |
i also have.
Code: | <Directory "c:/WWW/php">
Options FollowSymLinks
Allow from localhost
Order allow,deny
AllowOverride None
</Directory> |
I do have the right path in my path environment variables. It must be correct as I can open a command prompt in any directory and typing php.exe -v works fine and shows the version etc.
Its specifically just .php documents its not working on.
Last edited by DuMont on Fri 17 Nov '06 0:14; edited 1 time in total |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 0:12 Post subject: |
|
|
What happens if you change:
Action application/x-httpd-php "/PHP/php-cgi.exe"
to
Action application/x-httpd-php "/php/php-cgi.exe"
I have had experience where Apache can be case-sensitive, since it was born out of *nix world. |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 0:17 Post subject: |
|
|
Still the same error. |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 0:22 Post subject: |
|
|
Have you Stopped then Started Apache after every edit?
And you said HTML is working right? |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 0:24 Post subject: |
|
|
Yes. html and every other type working fine.
Yes. I do it from services concole. I actually stop and then start the server after every httpd.conf change.
Its just really annoying me. I can usually install any version of apache and php on any computer with no problems as I do it quite often. also i have uninstalled all previous versions correctly before installing this version and removed all files from previous version out of C;\WINDOWS and C:\WINDOWS\system32
I do however have apache running under a different account, an account belonging to the normal users group, but i have given this account full control over the directories it resides and the rest it needs.
Last edited by DuMont on Fri 17 Nov '06 0:31; edited 1 time in total |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 0:30 Post subject: |
|
|
Most likely it is something really simple that is being overlooked. What is the exact error message in the access.log? |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 0:34 Post subject: |
|
|
These are last entries in the acces log.
Code: | 127.0.0.1 - - [16/Nov/2006:22:19:47 +0000] "GET /index.php HTTP/1.1" 404 223
127.0.0.1 - - [16/Nov/2006:22:22:19 +0000] "GET /index.php HTTP/1.1" 404 219
127.0.0.1 - - [16/Nov/2006:22:22:21 +0000] "GET /index.php HTTP/1.1" 404 219
127.0.0.1 - - [16/Nov/2006:22:29:51 +0000] "GET /index.php HTTP/1.1" 404 223
127.0.0.1 - - [16/Nov/2006:22:29:52 +0000] "GET /index.php HTTP/1.1" 404 223 |
and these are last entries in error.log. It looks like it is looking for php in the wrong directory. My php is installed under C:\WWW\php\
Code: | [Thu Nov 16 22:29:51 2006] [error] [client 127.0.0.1] script not found or unable to stat: C:/WWW/Apache2.2/htdocs/php
[Thu Nov 16 22:29:52 2006] [error] [client 127.0.0.1] script not found or unable to stat: C:/WWW/Apache2.2/htdocs/php
[Thu Nov 16 22:32:57 2006] [error] [client 127.0.0.1] script not found or unable to stat: C:/WWW/Apache2.2/htdocs/php |
|
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 0:50 Post subject: |
|
|
The question is now, where is it getting the "C:/WWW/Apache2.2/"?
Can you run a PHPINFO page? |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 0:52 Post subject: |
|
|
no that is actually what is contained in the index.php
My apache is installed in C:\WWW\Apache2.2\
My php is installed in C:\WWW\php\ |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 1:24 Post subject: |
|
|
Have you ever installed PHP where it was looking for it?
Have you ever used one of the registry files included with PHP?
I suspect that the Apache2 Service in Services.msc is reflecting an earlier configuration. Check the Apache2 Service Properties and see if it agrees with what you have installed.
Suggestion: change the folder name of Apache2.2 to Apache2, and make necessary adjustments in CONF. Sometimes Windows will choke on 'dotted' folder names. |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 10:18 Post subject: |
|
|
No. My previous installations with php4 and apache 2.1.x where in
C:/Program Files/Apache Group/Apache2/
C:/Program Files/Apache Group/Apache2/php
These worked fine, but after i decided to upgrade tp php5 i decided to install them in C:\WWW\
I have renamed the folder to Apache2 from Apache2.2. It all works fine apart from .php files which I get the same error, 'cannot find server'.
The apache service entry must be right since it is loading apache from C:/WWW/Apache2/bin (it was loading from C:/WWW/Apache2.2/bin) |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 14:11 Post subject: |
|
|
I have set it up as a module, and its fine now, but I really wanted it as a cgi. Thanks for your help. |
|
Back to top |
|
pnllan
Joined: 05 Dec 2005 Posts: 221
|
Posted: Fri 17 Nov '06 20:05 Post subject: |
|
|
I can only comment on what you or anyone else show us. Since it was generating an error that was referencing PHP to C:/WWW/Apache2.2/htdocs/php rather than where you say you installed it, they were reasonable questions to ask. That path was coming from somewhere.
Good to hear you have it going... |
|
Back to top |
|
DuMont
Joined: 16 Nov 2006 Posts: 13
|
Posted: Fri 17 Nov '06 20:40 Post subject: |
|
|
Thanks for your help. |
|
Back to top |
|