leesiulung Posted May 8, 2007 Share Posted May 8, 2007 I'm working on a shared hosting environment where it appears error messages are not displayed. Is there a way to enable this through code? I do not have access to the control panel or anything of that nature. All I got is a username, password and ftp address. Help would be appreciated as this is frustrating... not knowing what is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/ Share on other sites More sharing options...
mmarif4u Posted May 8, 2007 Share Posted May 8, 2007 What kind of error u want to show to users.From php side or other sides. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-247896 Share on other sites More sharing options...
leesiulung Posted May 8, 2007 Author Share Posted May 8, 2007 Actually the showing of error message is just temporarily, so I can debug it. I need to identify what line there is problem with. I don't want to test it on my environment and then test it on the live server (that isn't really live).... To clarify I want to see errors in my code from server i.e. missing semicolon, syntax errors or runtime errors. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-247899 Share on other sites More sharing options...
jitesh Posted May 8, 2007 Share Posted May 8, 2007 Write error_reporting(E_ALL ^ E_NOTICE); at the first line of the page. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-247935 Share on other sites More sharing options...
leesiulung Posted May 8, 2007 Author Share Posted May 8, 2007 Write error_reporting(E_ALL ^ E_NOTICE); at the first line of the page. That should work, but it did not. I also tried: error_reporting(E_ALL | E_NOTICE); Still nothing being displayed. Any ideas why or any other ideas? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248202 Share on other sites More sharing options...
wildteen88 Posted May 8, 2007 Share Posted May 8, 2007 Just setting error_reporting to E_ALL it does not force PHP to display errors. In order to get PHP to display any errors you must enable the display_errors setting in the php.ini When you change anything in the php.ini make sure you save it and restart your http server(Apache, IIS etc). Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248303 Share on other sites More sharing options...
per1os Posted May 8, 2007 Share Posted May 8, 2007 You can try this going along with what Wildteen said: <?php ini_set('display_errors', 1); ?> http://us2.php.net/manual/en/function.ini-set.php Not sure if this would work, but it is worth a shot. Chances are the host diabled that option. Another option might be to create an .htaccess that does a similiar thing to ini_set. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248306 Share on other sites More sharing options...
Trium918 Posted May 8, 2007 Share Posted May 8, 2007 I am telling you guys, this dude is trying to hack!! Read is other post if you don't believe me. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248312 Share on other sites More sharing options...
leesiulung Posted May 8, 2007 Author Share Posted May 8, 2007 You can try this going along with what Wildteen said: <?php ini_set('display_errors', 1); ?> http://us2.php.net/manual/en/function.ini-set.php Not sure if this would work, but it is worth a shot. Chances are the host diabled that option. Another option might be to create an .htaccess that does a similiar thing to ini_set. I tried setting: ini_set('display_errors', 'on'); Did not work and so I reread your post and tried: ini_set('display_errors', '1'); Worked, and displayed unknown function errors, but does not display syntax errors of this kind: $str = 'a' 'b'; // missing concatenate operator $str = 'c' . 'd' // missing semicolon This is quite frustrating. I am telling you guys, this dude is trying to hack!! Read is other post if you don't believe me. This guy is plain annoying yet amusing.... I'm not going to even respond to this.... I appreciate all the posts genuinely trying to aid me, instead of accusing though! That last one almost worked. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248566 Share on other sites More sharing options...
per1os Posted May 8, 2007 Share Posted May 8, 2007 After you set the display errors set the error level to show what you want. as for this: $str = 'a' 'b'; // missing concatenate operator $str = 'c' . 'd' // missing semicolon The last semicolon is assumed. Try this instead $str = 'a' 'b'; // missing concatenate operator $str = 'c' . 'd' // missing semicolon $str = 'test me!'; And see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248569 Share on other sites More sharing options...
leesiulung Posted May 8, 2007 Author Share Posted May 8, 2007 semicolons are also assumed!!! That is terrible Anyhow, here is the code I used: ini_set('display_errors', 1); error_reporting(E_ALL ^ E_NOTICE); phpinfo(); $str = 'a' 'b'; $str = 'c' . 'd' $str = 'test me!'; I still got a blank page and the phpinfo() did not display. How do I set the error level? I can't find any info on error_level by searching other than error_reporting(); Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-248600 Share on other sites More sharing options...
per1os Posted May 9, 2007 Share Posted May 9, 2007 You can use .htaccess to do a php_ini portion to set error levels. http://www.evolt.org/article/Make_your_PHP_code_portable/17/28117/index.html That site might help you out. Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-249050 Share on other sites More sharing options...
leesiulung Posted May 10, 2007 Author Share Posted May 10, 2007 You can use .htaccess to do a php_ini portion to set error levels. http://www.evolt.org/article/Make_your_PHP_code_portable/17/28117/index.html That site might help you out. I'm so close to being done that I might just go on without the proper error reporting. However, I will take a look at that link and mark this thread solved. Just don't ever get hosting with SBC.... Frost110, I appreciate your continued help on this. Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/50452-solved-enable-php-error-output/#findComment-249924 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.