HELP! I HAVE A BLANK PAGE!! – errors defined
Posted by Lindsayanng on July 10th, 2009
So you just spent hours working on adding some plugin or addon to your website, and you save, and then go to see your handwork and your heart sinks – or maybe you feel like you are going to throw up, or throw your computer.. Well, don’t worry. Or at least, don’t start worrying until you have checked out a few things.
Generally, when you end up with a blank page, it is simply because in your host’s control panel, the function of error reporting is turned off. There is a good reason to have error reporting turned off, but it definitely should not be turned off if you are working on something. To turn on error reporting yourself, you will have to add this code to your .htaccess code
php_flag display_errors on
php_value error_reporting 6143
Error reporting is simply the ability for a browser to display errors in your website. This is invaluable as a code breaker like myself, because errors tell you a lot about what you did wrong. For instance, if you get the following error:
Fatal Error: can not redeclare …………………………….. previously declared on …..
This means that whatever function that is explained here has already been declared. Declared kind of means DEFINED, and a function is just that, a function. So if your website has a function that shows the categories box in your oscommerce store, and you copy and paste the code for that into the header so that you can have categories in your header too, you will have the same function delcared twice, hence this error. The lovely thing, it tells you where the error is, and where it was declared previously. From there, you can delete one of the two, or rename the function by putting a 2 at the end; like this: functionname2 and then go to where the function is being called from, and rename that one function2 as well.
Parse error: parse error, unexpected T_STRING in ………. on line ….
This is an error that is not as easy to define. A parse error means that there is likely something wrong in your syntax. That can mean anything from a missing curly bracket, semicolor, or quotation mark. As a newbie coder, you might need help. You can try and help yourself by looking for code within your own website that is similar to the one that you were working on, and compare it. For instance, when I first started, I was trying to add a new link in my header, but I wanted to use the proper php syntax using (tep_href_link) but it is a lot more complicated that linking using HTML. So what I did was find a place where I knew there was a good example of a link (in the header where the banner is) and copied it and pasted it where I wanted. Then I just changed the text and/or the name of the image.
**you should note that the line number stated in the error is not always where the error or missing piece of code actually is. generally if the error is not on that line, it means that you missed a curly bracket somewhere within that code.
Warning: Cannot add header information – headers already sent by (output started at /…………….:9) in….
This is the absolutely most simple error to fix – usually. It is generally caused by a white space at the beginning or the end of your code. HTTP headers must be sent before any output from your code, which means that a header function must be placed before any html or even a white space. So generally, you fix this by looking for an empty space before the first <?php tag or after the last ?>. You do this by putting the cursor at the tag, and deleting any white space before/after it. There should not be one single space or line before the first and after the last.
Warning: main(/index.php): failed to open stream: No such file or directory in…
This error simple means that the file mentioned does not exist in the directory that it is calling it from. It will tell you where in the code the file name is being called from, and where it should be. This is a pretty self explanatory fix. You need to either check and see if the file is there, or if the file name was typed incorrectly.
Other common errors that you see especially in oscommerce stores are from the database. The php code generally is trying to get information from a table inside of you database, but if those tables do not exist you will get errors like these:
1064 – You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ products_id from orders_products where orders_id = ’70” at li
select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from, products_id from orders_products where orders_id = ’70′
[TEP STOP]
This means that the code in your files that literally look exactly the same as this one is wrong. Each addon or installation will have different values listed for the tables. The second paragraph tells you all of the database tables that the code is trying to access. If you want to try and troubleshoot this error for yourself, you can log in to phpmyadmin on your host’s control panel, and click on your database. Then you will look for the tables with those names. They are organized very nicely and if you are familiar at all with excel and spreadsheets, you should be able to figure this out. If the tables exist, there might be some other error. If those tables do not exist, then that is your problem and you likely missed a step somewhere. It also could be the syntax in which you are trying to call for the database that is throwing this error, so it could likely be more complicated.
There is also the error that tells you that the tables do not exist, and these look like this:
1146 – Table ‘db_dbname.orders_status_history_transactions’ doesn’t exist
INSERT INTO orders_status_history_transactions ( `orders_status_history_id`, `transaction_id`, `transaction_type`, `payment_type`, `payment_status`, `transaction_amount`, `module_code`, `transaction_avs`, `transaction_cvv2`, `transaction_msgs` ) VALUES ( 328, ’1JV740438A749591H’, ‘CHARGE’, ‘INSTANT’, ‘COMPLETED’, 36.87, ‘paypal_wpp’, ‘Yes Address and five-digit ZIP’, ‘Match CVV2′, ” )
[TEP STOP]
This is similar to the last one I mentioned in that it is tell your specifically that those tables do not exist, and you missed a step somewhere. Likely, if you were installing an oscommerce addon, you did not input the mysql “code” or you did not import the file to have the code run. If you do not know how to do that, keep and eye out. I will write a quick tutorial on how to do this.
So the moral of the story is… read. If you simply take your time and read your code, instead of instantly copying it and pasting it into a help forum screaming PLZ HELP!!!! you will teach yourself more about the inner workings of your website, and you will learn how to fix your own errors! Breaking the code is how I learned about this stuff, so dont worry if you break it – just always keep a backup!
***also remember to remove error reporting when your store is live. If you keep it on and an error shows, it can give a possible hacker some deadly information like the name and location of various information in your database. ***
