403 Forbidden using php in working mode. Only for php files from the browser

First of all let me say that yes, I searched this on google and on stackoverflow, I found many answers and tried all of them. At the moment, I believe that my only resource asks a question myself, even if the script repeats, please be kind to try to help.

The situation is quite simple, on the Ubuntu 10.04 desktop I configured apache via Synaptic and Php5 according to this guide and highlighting it here . At this point, if I go to the command line and call the php script, it works, for example:

  php test.php

displays my world hello without any problems. But if I go to firefox and point to test.php, it will show 403 Forbidden error ...

I changed ownership to / var /, / var / www / and / var / www / test.php for every variable I can think of (www-data [apache works like this user], purefan [my regular user] , root), it does not matter, I also changed the permissions 777, 0777 several times (just to be safe), 644, 755, without changes. from the CLI I got phpinfo to a file and added it here .

If Im not mistaken, the problem occurs when Apache calls the PHP interpreter, because when I go to http: //localhost/index.php , it shows apache default β€œIt works!”, But if I add php content to this file, it is simply ignored until an error is displayed (the error log and syslog are also checked).

, , - , , , , , .

+3
4

. apache2 mpm php5 fastcgi . ( ) , .

- . , , :

, apache2 mpm- php5 fastcgi:

  • apache2
  • apache2-MPM-
  • php5-
  • php5-CGI
  • php5-
  • libapache2--fcgid

, apache, php . /etc/apache 2/conf.d php.conf. :

<Directory /usr/share>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options ExecCGI FollowSymlinks Indexes
</Directory>

<Files ~ (\.php)>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options  ExecCGI
    allow from all
</Files>

. , , , (www- 644 755 ).

, <Files></Files>. . php <Files>, <Directory> . :

<Directory /var/www/website/>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options  ExecCGI Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

! , ... , , .

, -:)

: , : http://forum.parallels.com/showthread.php?t=85413

+5

PHP-, ExecCGI apache httpd.conf

Options Indexes FollowSymLinks **ExecCGI**

AllowOverride None
Require all granted

+2

, Apache2 PHP?

, php5-cli, apache2.

this . , .

+1

. . : .htaccess :

# Follow symbolic links in this directory.
Options +FollowSymLinks

.

0

Source: https://habr.com/ru/post/1771218/


All Articles