PHP - localhost is currently unable to handle this request. HTTP ERROR 500
You display_errors
directive is set to no
.
To fix this:
Edit
/etc/php/7.0/apache2/php.ini
and set:; display_errors ; Default Value: On ; Development Value: On ; Production Value: Off ; display_startup_errors ; Default Value: Off ; Development Value: On ; Production Value: Off #to ; display_errors ; Default Value: On ; Development Value: On ; Production Value: On ; display_startup_errors ; Default Value: On ; Development Value: On ; Production Value: On
Restart your apache with:
sudo systemctl restart apache2
To have the same behaviour on the
cli
edit the/etc/php/7.0/cli/php.ini
To set this value locally add this to a
.htaccess
file in the server root:/var/www/html
Do
vim .htaccess
Press i
Type the following:
# Displaying php errors
php_flag display_errors on
php_value error_reporting 6143
Press
Esc
:x
Enter
Note:
Mine was php version 7.0
. Change to your particular version. And in your image both local
and master
values are both set to Off
so:
step 1
will change themaster value
, andstep 4
will change thelocal value
.
Related videos on Youtube
Comments
-
FreeKrishna over 1 year
I'm currently trying to get php , apache and mysql up and running on Ubuntu. I've recently switched from Windows to Ubuntu to learn. But i'm facing a bit of a problem. When the code is correct the file gets executed properly in browser, where as when there is an syntax error, instead of showing the error in browser it throws an error as shown.
I've checked my php setting via phpinfo() and its as follows. phpinfo
I think error reporting is enabled, and I've tried reading similar other questions on the various threads,but they didn't really help me out. They pointed out that i need to verify that .htaccess file is in good shape. I'm not exactly sure how do i verify that, can anyone help me out? I've also tried changing directory permissions to 777 and 755 but that didn't help either. Any idea as to how can i fix it?
-
George Udosen over 7 yearsThe value
dispay_errors
isoff
needs to beon
... -
George Udosen over 7 yearsserver root is /var/www for older versions of
Ubuntu 14.04 -
, and/var/www/html
forUbuntu 14.04 +
, thensudo service apache2 restart
is the old way forUbuntu 14.04
andsudo systemctl restart apache2
is for` Ubuntu 16.04` but if you use sudo service for Ubuntu 16.04 it will still go.
-
-
FreeKrishna over 7 yearsThanks a lot @George , the first step worked for me. I still have a few doubts. When you say .htaccess file in server root, is it the
/etc/apache2
directory? Also is there any difference betweensudo systemctl restart apache2
andsudo service apache2 restart
-
George Udosen over 7 yearsserver root is
/var/www
for older versions ofUbuntu 14.04 -
, and/var/www/html
forUbuntu 14.04 +
, thensudo service apache2 restart
is the old way forUbuntu 14.04
andsudo systemctl restart apache2
is forUbuntu 16.04
but if you use sudo service for Ubuntu 16.04 it will still go -
Kulfy about 5 yearsCan you please be a little bit more descriptive?