Mateobus Posted October 27, 2006 Share Posted October 27, 2006 Hello all,Issue #1)I recently switched from a shared hosting plan to a dedicated server. When I switched I switched from php 4 to php 5. All of my scripts seem to run fine, with minimal differences. However, before, if I made a parse error, the error would display on the page, UNEXPECTED ... PARSE ERROR. Now this no longer happens. If there is a parse error, the page will simply not display. I would like to get the old errors back. Another issue...Issue #2) My website takes up about 30 gig including everything. I have about 150 gig of server space which recently filled up completely becasue my error_log file got to about 120GB. The error log contains millions of php errors such as undefined var errors which don't stop the scripts from running, just report stupid errors. One example of these errors is an undefined var in an if statement. here is a sample of the code.page.php?[code]if ($_GET['some_var'] == '') //do something[/code]Well, this creates an error if the some_var variable is not set within the URL. But this is stupid because it works correctly, because if it is not set it is also the empty string '', so it performs as I want it to despite accumulating a 120GB file on my server. Is there anything I can do about that? Is that in any way related to php 4 vs. php 5.Issue #3)My scripts, including some that were written in open source by professionals, send out emails automatically (for example to register to a forum). These emails no longer get sent. Is this possibly related to the difference in php versions. Maybe its a firewall thing? Any help at addressing any one of these issues is appreciated. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 27, 2006 Share Posted October 27, 2006 Sounds like you need to change the error reporting level in your php.ini file to stop it reporting E_NOTICE errors. The alternative is code to avoid the errors in the first place by always checking that a variable is set before trying to access its value. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 28, 2006 Share Posted October 28, 2006 For issue #1 you need to turn your error_reporting level up to E_ALL and turn display_errors onFor issue #2 it is not a stupid error. It actually an error on your part, your syntax is slightly wrong basically. With the following code:[code]if ($_GET['some_var'] == '')[/code]You are checking the $_GET['some_var'] variables value and not the existence . However if this variable does not exist then PHP will report an undefined variable/index notice (not an error). What you should do is first check for the existence of the variable and then check the value of the variable if it exists. So you'll do something like this:[code]if(isset($_GET['some_var']) && $_GET['some_var'] == '')[/code]Now when you run your script. PHP will now check for the existance of the $_GET['some_var'] variable first, then if it finds the variable it will now check the value of the variable. Whereas before you are not checking the existence of the variable and so PHP thinks this variable already exists and thus you get the undefined notice message. If(isset($var)) and if($var) are two completely different things, they are similar but they have different behaviour.For issue #3 you may need to configure PHP to use your server SMTP Server. Quote Link to comment 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.