PHP无法在EC2 + ubuntu + apache2

时间:2015-06-14 17:30:28

标签: php apache ubuntu amazon-ec2 virtualhost

PHP不起作用。

开发环境如下。

  • EC2服务器
  • 的Apache / 2.4.7
  • PHP 5.5.9-1ubuntu4.9

如果我设置DocumentRoot /var/www/html,那么php效果很好。

另一方面,如果我设置/home/ubuntu/public_html,php不起作用,但html有效。

$ vi /etc/apache2/sites-available/000-default.conf

    ServerAdmin webmaster@localhost
    DocumentRoot /home/ubuntu/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

1 个答案:

答案 0 :(得分:0)

我通过以下方法解决了这个问题。

sudo vi /etc/apache2/mods-enabled/php5.conf

▼之前

             php_admin_flag引擎关闭     

▼更改

             php_admin_flag引擎开启