PHP 7.2 已啟用,但無法在我的網站上執行

PHP 7.2 已啟用,但無法在我的網站上執行

我剛剛重新安裝了 Ubuntu 16.04,我想在上面放置 2 個網站。我已經安裝了 Apache2、PHP 7.2

我的網站安裝在這個路徑上:/var/www/html/benshepherd.me

我已將此文件(benshepherd.me.conf)新增至/etc/apache2/sites-available/

<VirtualHost *:80>
    ServerName      benshepherd.me
    ServerAlias     www.benshepherd.me
    DocumentRoot    "/var/www/html/benshepherd.me"

    CustomLog       /var/log/apache2/benshepherd.me-access.log common
    ErrorLog        /var/log/apache2/benshepherd.me-error.log
    <Directory /var/www/html/benshepherd.me>
        AllowOverride All
    </Directory>
</VirtualHost>

我跑了a2ensite benshepherd.me,我跑了a2enmod php7.2

我已經創建了一個可以運行phpinfo()並且可以正常工作的文件。

然而,當我訪問我的網站時,該行程式碼<?php include('includes/styles.php'); ?>將不會執行,而是以 html 輸出形式出現。

答案1

我是一個白痴。

我在與index.php相同的目錄中有一個index.html文件

:|

答案2

確保您的 apache 配置(無論是主配置還是任何不同的子配置,取決於您的伺服器平台)具有如下行:

AddType application/x-httpd-php .php

相關內容