Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache and PHP problems |
|
Author |
|
Joe N
Joined: 22 Sep 2009 Posts: 2
|
Posted: Tue 22 Sep '09 2:08 Post subject: Apache and PHP problems |
|
|
Hi,
I am new here so please forgive me if this is a "noobish" question or has already been answered somewhere else.
I am running Windows Server 2003 (Web Edition) and Apache 2.2 and PHP 5. I am trying to configure Apache to use php-cgi.exe to handle php pages. However, when I try to load the test.php file on my web server, I get this error:
404 Not Found
Not Found
The requested URL /Program Files/PHP/php-cgi.exe/test.php was not found on this server.
This is what the Apache error log has to say about it:
Code: | [Mon Sep 21 20:04:16 2009] [error] [client 192.168.1.101] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/Program Files
[Mon Sep 21 20:04:16 2009] [error] [client 192.168.1.101] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/favicon.ico |
My httpd.conf file:
Code: |
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
ServerName 192.168.1.102
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
ScriptAlias /php/ "C:/Program Files/PHP/"
</IfModule>
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<Directory "C:/Program Files/PHP/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddType application/x-httpd-php .php
Action Application/x-httpd-php "C:/Program Files/PHP/php-cgi.exe"
</IfModule>
|
Once again, sorry if this is a noobish question or has already been covered, but I would like to have this problem figured out.
Thank you in advanced .
Modnote: Do not post the whole httpd.conf. See forum rules. I removed all standart stuff from the config file you posted |
|
Back to top |
|
paranid
Joined: 02 Mar 2009 Posts: 11
|
Posted: Tue 22 Sep '09 11:06 Post subject: |
|
|
Hi, it is not such a "noobish" question as you might think. I really do not understand the official configuration of PHP as CGI (what the configuration really does). I think it is because they wanted "PHP as CGI" to work the same way as "PHP as module", but anyway, there is a problem here:
Action Application/x-httpd-php "C:/Program Files/PHP/php-cgi.exe"
This one should work:
Code: |
<Directory "C:/Program Files/PHP/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /php/ "C:/Program Files/PHP/"
AddType application/x-httpd-php .php
Action Application/x-httpd-php "/php/php-cgi.exe"
|
I would also add the directory with php.ini
Code: |
SetEnv PHPRC "C:/Program Files/PHP"
|
The last time I played with PHP5 as CGI, I had to juggle with cgi.* directives in php.ini ... |
|
Back to top |
|
Joe N
Joined: 22 Sep 2009 Posts: 2
|
Posted: Wed 23 Sep '09 4:08 Post subject: |
|
|
Hi,
Thank you for the response. However, I reinstalled PHP and installed it as an Apache Module. From what I've heard this method is much faster and much more secure. It was also a lot easier to configure. My suggestion to anyone installing PHP with Apache: install PHP as an Apache Module . |
|
Back to top |
|
peacemaker
Joined: 23 May 2008 Posts: 80
|
Posted: Wed 23 Sep '09 8:11 Post subject: PHP Apache Problem |
|
|
Hi i dont no wat exactly wat ur problem, but i have written a big procedure how to install WAMP (seperately not as XAMP or phpadmin)
so have look at my posts here and, hope u wil get something out of it.
try to install php,mysql,apache seperately and try to configure it , u will learn a lot how error comes and what need to be done, instead installing XAMP or phpadmin. This is my personnel advice as i learned a lot from that seperate installtion of WAMP.
So give a try |
|
Back to top |
|
|
|
|
|
|