PHP 5 Not Showing Errors
Moderator: General Moderators
PHP 5 Not Showing Errors
I have upgraded from PHP 4.2.3 to PHP 5.2.2 and now if I have an error in my code it does not display what the error is, it does not display anything in fact, it just shows a blank page.
I have checked my php.ini configuration and display_errors is set to "On" and error_reporting is set to "E_ALL & ~E_NOTICE".
I am also wondering why the pdf section no longer shows. My host says that PDF Support is enabled and all of my web sites PDF functions do work, it just isn't showing in my config when I run phpinfo();, weird.
I have checked my php.ini configuration and display_errors is set to "On" and error_reporting is set to "E_ALL & ~E_NOTICE".
I am also wondering why the pdf section no longer shows. My host says that PDF Support is enabled and all of my web sites PDF functions do work, it just isn't showing in my config when I run phpinfo();, weird.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Run the following in a new file and tell us the results please.
Code: Select all
<?php
$neg = array('off', 0, false, '', null);
$flags = array(
'Register Globals' => 'register_globals',
'Short Tags' => 'short_open_tag',
'Display Errors' => 'display_errors',
'Magic Quotes GPC' => 'magic_quotes_gpc',
'Magic Quotes Runtime' => 'magic_quotes_runtime',
'Magic Quotes Sybase' => 'magic_quotes_sybase',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$flags['Config file'] = get_cfg_var('cfg_file_path');
if (empty($flags['Config file']))
{
$flags['Config file'] = '-';
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";
$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
$le .= ' ' . implode(' ', array_slice($gle, $i, $wide)) . $eol;
}
$ec = array(
'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
$e2 = array();
foreach ($ec as $n => $v)
{
if (!in_array($n, $e) and $n != 'E_ALL')
{
$e2[] = $n;
}
}
$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
$er = $er . ' (' . implode(' | ', $e) . ')';
}
if (!$cli)
{
echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}
echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;
if (!$cli)
{
echo '</pre></body></html>', $eol;
}
?>Code: Select all
PHP Version: 5.2.2
PHP OS: Linux
Error Reporting: 0 ()
Register Globals: Off
Short Tags: On
Display Errors: On
Magic Quotes GPC: On
Magic Quotes Runtime: Off
Magic Quotes Sybase: Off
Config file: /usr/local/lib/php.ini
Loaded Extensions:
xmlwriter libxml xmlrpc dom
xmlreader xml wddx tokenizer
session pcre SimpleXML SPL
PDO sockets SQLite standard
Reflection posix pdo_sqlite mysqli
mysql mhash mcrypt mbstring
json imap iconv hash
gettext gd ftp filter
exif date curl ctype
calendar bcmath zlib openssl
apacheWhere do I edit that in my php.ini file? Everything looks to be ok to me.
I have looked through the manual and I havn't found anything else that I can enable to show errors.
Here is my PHP Core section of my phpinfo(); output:
I have looked through the manual and I havn't found anything else that I can enable to show errors.
Here is my PHP Core section of my phpinfo(); output:
Code: Select all
allow_call_time_pass_reference On On
allow_url_fopen On On
allow_url_include Off Off
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log error_log error_log
error_prepend_string no value no value
error_reporting E_ALL & ~E_NOTICE E_ALL & ~E_NOTICE
expose_php On On
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20020429 /usr/local/lib/php/extensions/no-debug-non-zts-20020429
file_uploads On On
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/lib/php:/usr/local/lib/php .:/usr/lib/php:/usr/local/lib/php
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no value no value
max_execution_time 160 160
max_input_nesting_level 64 64
max_input_time 160 160
memory_limit 60M 60M
open_basedir no value no value
output_buffering no value no value
output_handler no value no value
post_max_size 60M 60M
precision 12 12
realpath_cache_size 16K 16K
realpath_cache_ttl 120 120
register_argc_argv On On
register_globals Off Off
register_long_arrays On On
report_memleaks On On
report_zend_debug On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 3M 3M
upload_tmp_dir no value no value
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
zend.ze1_compatibility_mode Off Off
Last edited by icesolid on Thu Sep 06, 2007 8:29 am, edited 1 time in total.
It looks to me like error reporting is on.
Putting this at the top of your script may prove to do some good.
Code: Select all
ini_set('display_errors', 'On');
error_reporting(E_ALL);Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Do you have a .htaccess file overriding this?
Post your actual php.ini and not phpinfo()'s output.. although I don't really see how it could differ. =/
Post your actual php.ini and not phpinfo()'s output.. although I don't really see how it could differ. =/
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Even when I run this code (which should produce an error) no error displays, I just get a blank white page.
Code: Select all
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$user_computer = get_browser(null, true);
echo $user_computer["browser"] . "<br>";
echo $user_computer["platform"] . "<br>
?>How do I make that show the error?
In PHP 4 if I placed the code below in a file and ran it I would for sure get an error displayed (notice the missing "; at the end of the code).
Now that I have installed 5.2.2 I am not getting anything but a blank page.
In PHP 4 if I placed the code below in a file and ran it I would for sure get an error displayed (notice the missing "; at the end of the code).
Code: Select all
<?php
$user_computer = get_browser(null, true);
echo $user_computer["browser"] . "<br>";
echo $user_computer["platform"] . "<br>
?>
Last edited by icesolid on Fri Sep 07, 2007 12:32 pm, edited 1 time in total.