Apache将php页面加载为文本

时间:2015-10-19 09:50:46

标签: php apache debian

我遇到了Apache2服务器的问题。 我在Debian OS上使用VDS。 服务器将所有文件显示为纯文本。

此处示例:click

Apache配置:

<VirtualHost 213.159.209.165:80>
    ServerName pixellot.ru
    AddDefaultCharset off
    AssignUserID romancasper romancasper
    DirectoryIndex index.html index.php
    DocumentRoot /var/www/romancasper/data/www/pixellot.ru
    ServerAdmin webmaster@pixellot.ru
    ServerAlias www.pixellot.ru
    CustomLog /var/www/httpd-logs/pixellot.ru.access.log combined
    ErrorLog /var/www/httpd-logs/pixellot.ru.error.log
    <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 webmaster@pixellot.ru"
    php_admin_value upload_tmp_dir "/var/www/romancasper/data/mod-tmp"
    php_admin_value session.save_path "/var/www/romancasper/data/mod-tmp"
    php_admin_value open_basedir "/var/www/romancasper/data:."
</VirtualHost>
<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>
<Directory /var/www/romancasper/data/www/pixellot.ru>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

我需要做什么?

1 个答案:

答案 0 :(得分:0)

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

替换为:

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

或将应用类型更改为:application / octet-stream或text / html