A
A
Andrey Privalov2014-11-08 19:18:38
Apache HTTP Server
Andrey Privalov, 2014-11-08 19:18:38

Why does Apache emit php code when DocumentRoot changes?

There is a folder with the site /var/www/user/data/www/site.ru
Filled near /var/www/user/data/www/site.ru.v2 and I want to set Apache on it.
I change the DocumentRoot in the config (I add .../site.ru.v2/public), I
restart Apache and it gives out the php code as it is.
What can be wrong? If DocumentRoot is returned to .../site.ru, then php is processed quite correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Privalov, 2014-11-08
@negasus

Code /etc/apache2/vhosts/user/site.ru

<VirtualHost 127.0.0.1:8080>
        ServerName site.ru
        AddDefaultCharset UTF-8
        AssignUserID user user
        DocumentRoot /var/www/user/data/www/site.ru
        ServerAdmin adminSite.ru
        ServerAlias www.site.ru
        <FilesMatch "\.ph(p[3-5]?|tml)$">
                SetHandler application/x-httpd-php
        </FilesMatch>
        <FilesMatch "\.phps$">
                SetHandler application/x-httpd-php-source
        </FilesMatch>
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f adminSite.ru"
        php_admin_value upload_tmp_dir "/var/www/user/data/mod-tmp"
        php_admin_value session.save_path "/var/www/user/data/mod-tmp"
        php_admin_value open_basedir "/var/www/user/data:."
        CustomLog /var/www/httpd-logs/site.ru.access.log combined
        ErrorLog /var/www/httpd-logs/site.ru.error.log
</VirtualHost>
<Directory /var/www/site/data/www/site.ru>
        php_admin_flag engine on
        Options -ExecCGI
</Directory>

Z
zooks, 2014-11-09
@zooks

Most likely the handler for PHP is specified only for the first site.

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question