how to fix error 500 Internal Server Error when trying to open my php page in my subdirectory, ?

Posted February 24, 2018 14.6k views
ApacheUbuntu 16.04

My page has a simple script which is the

echo “Hello”;

But I got internal error. I don’t know whats happening! . Please do help.

1 comment
  • Please people do help. I just wanted to setup my newly developed web app. I already tested it locally and its working well but when I try to setup here in droplets I got this internal error. even a simple script I still got error. Even if I already setup apache2 and mysql-server.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

This could be file permissions.ownership - So if your public_html is under /var/www/ you would do something like this.

chown -R www-data:www-data /var/www/

Anything in Apache error logs? Presumably /var/log/apache2/error_log?

And as you’re most likely running mod_php it could also be that there’s something wrong with php.ini as well. Try running php -v and see if you get anything else than the actual PHP version information.

  • Heres the error logs I got

    [Sun Feb 25 23:54:09.577533 2018] [:error] [pid 13784] [client] PHP Notice: Use of undefined constant \xe2\x80\x9cfailed\xe2\x80\x9d - assumed ’\xe2\x80\x9cfailed\xe2\x80\x9d’ in /var/www/html/config/index.php on line 12

    and this is the version I have.

    PHP 7.0.25-0ubuntu0.16.04.1 (cli) ( NTS )
    Copyright © 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright © 1998-2017 Zend Technologies
    with Zend OPcache v7.0.25-0ubuntu0.16.04.1, Copyright © 1999-2017, by Zend Technologies