How can I make PHP display the error instead of giving me 500 Internal Server Error [duplicate]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
This question already has an answer here:
PHP's white screen of death
15 answers
This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?
I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?
apache php
marked as duplicate by Your Common Sense
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Aug 15 '17 at 7:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
PHP's white screen of death
15 answers
This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?
I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?
apache php
marked as duplicate by Your Common Sense
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Aug 15 '17 at 7:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
3
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48
add a comment |
This question already has an answer here:
PHP's white screen of death
15 answers
This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?
I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?
apache php
This question already has an answer here:
PHP's white screen of death
15 answers
This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?
I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?
This question already has an answer here:
PHP's white screen of death
15 answers
apache php
apache php
asked Apr 22 '10 at 1:45
RobRob
3,3322262105
3,3322262105
marked as duplicate by Your Common Sense
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Aug 15 '17 at 7:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Your Common Sense
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Aug 15 '17 at 7:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
3
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48
add a comment |
3
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48
3
3
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48
add a comment |
7 Answers
7
active
oldest
votes
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file withphp_flag display_errors 1
– Tom
Jan 16 at 10:57
add a comment |
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
add a comment |
Use "php -l <filename>" (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
add a comment |
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
add a comment |
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
add a comment |
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
add a comment |
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)
add a comment |
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file withphp_flag display_errors 1
– Tom
Jan 16 at 10:57
add a comment |
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file withphp_flag display_errors 1
– Tom
Jan 16 at 10:57
add a comment |
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
edited Jan 7 '13 at 15:01
Davide Palmieri
6841920
6841920
answered Apr 22 '10 at 1:49
awgyawgy
11.8k42017
11.8k42017
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file withphp_flag display_errors 1
– Tom
Jan 16 at 10:57
add a comment |
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file withphp_flag display_errors 1
– Tom
Jan 16 at 10:57
1
1
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
How do we turn off display_errors, yet have PHP display 200 or 404 instead of 500?
– Pacerier
Jul 22 '13 at 16:11
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Not sure if it was in 2010 but, you don't need to restart the server (unless using an opcode cache like APC) in 2014.
– Czar Pino
Aug 16 '14 at 11:20
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
Even after doing all that I still get the 500 error... perhaps it is coming from IIS?
– Kolob Canyon
Oct 12 '17 at 22:52
1
1
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
Sometimes wrong permissions in a Linux environiment can lead to a 500 error too. Just as a reminder.
– Fusseldieb
Nov 22 '17 at 9:56
If you cannot modify php.ini, you can add a .htaccess file with
php_flag display_errors 1– Tom
Jan 16 at 10:57
If you cannot modify php.ini, you can add a .htaccess file with
php_flag display_errors 1– Tom
Jan 16 at 10:57
add a comment |
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
add a comment |
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
add a comment |
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
edited Mar 4 '15 at 21:18
answered Aug 4 '14 at 1:53
dtbarnedtbarne
6,37243544
6,37243544
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
add a comment |
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
3
3
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
I was actually missing a module on apache. I got that by looking the error log (default for ubuntu is /var/log/apache2/error.log)
– Eduardo Mello
Mar 4 '15 at 13:07
add a comment |
Use "php -l <filename>" (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
add a comment |
Use "php -l <filename>" (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
add a comment |
Use "php -l <filename>" (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
Use "php -l <filename>" (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
answered May 25 '16 at 3:53
AaronAaron
189211
189211
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
add a comment |
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
1
1
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
This really helped me out! Tail'ing my error log produced nothing, but this gem worked perfectly and displayed my syntax error and the line number. Was debugging a Class file. Thanks!
– Source Matters
Mar 19 '17 at 3:50
add a comment |
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
add a comment |
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
add a comment |
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
answered Apr 4 '16 at 5:05
Hao NguyenHao Nguyen
45438
45438
add a comment |
add a comment |
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
add a comment |
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
add a comment |
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
edited Nov 18 '17 at 20:44
answered Mar 20 '17 at 20:57
von verletztvon verletzt
945
945
add a comment |
add a comment |
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
add a comment |
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
add a comment |
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
answered Sep 9 '16 at 15:17
MaxMax
1,7211218
1,7211218
add a comment |
add a comment |
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)
add a comment |
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)
add a comment |
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)
answered Mar 6 '17 at 12:16
WoodrowShigeruWoodrowShigeru
469713
469713
add a comment |
add a comment |
3
That sounds like an apache problem, not a PHP problem. Apache will throw a 500 any time it has configuration issues (like bad syntax in .htaccess). Check your apache error log for an error message.
– Frank Farmer
Apr 22 '10 at 1:48