PHP doesn't work on virtual host in EC2 + ubuntu + apache2

191 views Asked by At

PHP doesn't work.

Development environment is the below.

  • EC2 Server
  • Apache/2.4.7
  • PHP 5.5.9-1ubuntu4.9

If I set DocumentRoot /var/www/html, php works well.

On the other hand if I set /home/ubuntu/public_html, php doesn't work, but html works.

$ 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

There are 1 answers

0
uekyo On

I resolved it by the below method.

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

▼Before

php_admin_flag engine Off

▼Change

php_admin_flag engine On