Collections:
Other Resources:
Getting HTTP 403 (Forbidden) Error on PHP Scripts
What is causing the HTTP 403 (Forbidden) error when running PHP scripts with PHP CGI configuration?
✍: FYIcenter
1. Enter and save the following PHP script as C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\my_first.php.
<html> <body> This is <?php echo "my first PHP script"; ?>. </body> </html>
2. Run a Web browser with http://localhost:8080/my_first.php. You will probably get a HTTP 403 (Forbidden) error like this:
3. There is no permission problem with my_first.php, because it is located in the document root directory. The problem is the permission of running php-cgi.exe.
4. Open in "notepad" Apache server error log file at: C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log. You should see line like this:
[...] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/php-5.2.0-Win32 /php-cgi.exe
5. The cause of the problem is that C:/Program Files/php-5.2.0-Win32 is defined as script directory in the Apache server configuration, but no permission is given to that directory. This is a mistake in the PHP installation guide.
6. Open in "notepad" Apache server configuration file at: C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf. Review and enter the following directory definition:
<IfModule alias_module>
...
ScriptAlias /php/ "C:/Program Files/php-5.2.0-Win32/"
</IfModule>
...
<Directory "C:/Program Files/php-5.2.0-Win32/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
...
<IfModule mime_module>
...
AddType application/x-httpd-php .php
</IfModule>
8. Restart your Apache server, the HTTP 403 error should be gone. Follow our Configuring Apache for PHP Scripts tutorial for more explanations.
2013-01-23, ≈85🔥, 2💬
Popular Posts:
Using Columnar as the layout for a form as shown in the previous tutorial is good to enter new recor...
How to download and install HiJackThis? If you want to download and install HiJackThis to your Windo...
How to play music files with Windows Media Center? If you have Windows Media Center setup correctly,...
What is "Secondary Logon" in my Windows XP service list? And how is "Secondary Logon" service relate...
What files are stored in the "C:\Users\<userid >\AppData\Local\M icrosoft\Windows\Tempor. ..