Apache Virtual Host not parsing PHP

后端 未结 10 1193
日久生厌
日久生厌 2020-12-05 23:42

I decided to enable virtual hosts on my Apache server, and chose to make it port-based.

First thing I did, of course, was RTM. I followed the instructions found her

相关标签:
10条回答
  • 2020-12-06 00:36

    the only thing that helped me after all tried add apache2.conf

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    
    0 讨论(0)
  • 2020-12-06 00:39

    Your answer did not work for me.

    For Ubuntu 12.04:

    sudo a2enmod php5
    sudo service apache2 restart
    

    This did it.

    source: https://help.ubuntu.com/community/ApacheMySQLPHP

    0 讨论(0)
  • 2020-12-06 00:42

    Make sure the following line which loads the php module is not commented out -

    LoadModule php5_module libexec/apache2/libphp5.so
    
    0 讨论(0)
  • 2020-12-06 00:43

    This finally put me on the right path:

    http://www.linuxquestions.org/questions/linux-server-73/php-not-working-on-one-vhost-but-works-on-all-others-851093/

    Here's the solution:

    In the <Directory> section, I included these lines:

    <IfModule sapi_apache2.c>
        php_admin_flag engine on
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine on
    </IfModule>
    

    Or, a redacted copy/paste of the solution on my server:

    <Directory "/var/www/vhosts/A2/httpdocs">
        <IfModule sapi_apache2.c>
            php_admin_flag engine on
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_flag engine on
        </IfModule>
    
        (Other configuration parameters)
    
    </Directory>
    
    0 讨论(0)
提交回复
热议问题