且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

浏览器下载来自Apache Web服务器的PHP文件

更新时间:2023-02-05 08:49:43

如果你是在Debian / Ubuntu的看看这个文件 /etc/apache2/mods-available/php5.conf

If you are on Debian/Ubuntu take a look at this file /etc/apache2/mods-available/php5.conf

矿看起来像这样,你可以看到,我不得不发表评论一些行让PHP在用户目录工作

mine looks like this and you can see I had to comment some line to get PHP working in the user dir

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_value engine Off
    #    </Directory>
    #</IfModule>
</IfModule>

请注意,编辑的文件后,你将不得不重新启动Apache以使修改生效,重新启动基于Debian的系统上的Apache的命令是: /etc/init.d/apache2重启

Please note that after editing the file you would have to restart apache for the modifications to take effect, the command to restart apache on a debian based system is: /etc/init.d/apache2 restart