php problems with godaddy?

Discussion in 'Web Design and Development' started by chainprayer, Jan 8, 2009.

  1. chainprayer macrumors 6502a

    Feb 10, 2008
    anyone else ever have any problems using php with godaddy? i have a simple php script set up to connect to my sql database. when there is an error in the code it returns a blank page instead of an error with a reference to the error line. anyone else have this happening?
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    If GoDaddy doesn't give you access to the PHP error log file then you can try to catch the errors using try..catch and/or die statements.
  3. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    A blank page usually means a "fatal" error such as a typo in a function name, missing ; on the end, syntax error as the script is intepreted.

    You can trap (PHP4:most, PHP5: almost all) errors with set_error_handler() callback function but be sure to read the exceptions and notes on this page at
  4. CANEHDN macrumors 6502a


    Dec 12, 2005
    Eagle Mountain, UT
    You could post some of your code and maybe we could help you.
  5. DipDog3 macrumors 65816


    Sep 20, 2002
    I second this. Check that all lines of codes end with ; and that all comments are probably commented.

    When I can't find the problem, I will comment out sections of the code until the PHP file runs, then I can narrow down the problem.
  6. IanTheLesser macrumors newbie

    Aug 4, 2010
    checking database access

    I can relate -- I've had issues I still don't understand with GoDaddy's php server, and I have some background with php and am using a Linux server, not the Windows flavor.

    Here's a few things that can help, though:

    (hopefully not restating the obvious) Try queries first from GoDaddy's phpMyAdmin, which you can get to from the Hosting control panel by selecting Databases, clicking on MySQL, and going through the login if you've got your DB's set up. Sometimes this can reveal details missed on the code side, where you're usually dealing with inline SQL.

    Make sure that if you use any $_POST or $_GET variables in your query and are using double quotes or heredoc, you enclose them in curly brackets. If they're string values, put the curly brackets inside the quotes that go into the SQL.

    Finally, even if you don't have access to the error log file directly, I found out recently that php has nifty functions just to check this kind of thing -- it would work something like this:

    //assuming connection has already been made and DB selected
    $result = mysql_query($query, $connection);
    if (!$result) {
    $report = 'Query failed for the following reason: <br />';
    $report.= mysql_errno($connection). ": ";
    $report.= mysql_error($connection);
    echo $report
    //alternately, if this is a backend process like PayPal IPN,
    //you could use mail($recipient, "Query Failed", $report)
    Hopefully this is helpful.
  7. harpster macrumors regular

    Jan 26, 2010
    You might have an error in your SQL statements and often that will not output an error message. You can use the "die" statement combined with "mysql_error" as in the following two examples. Either one with your connect values should output an error if there is one.

    if (!
    $link) {
    'Could not connect: ' mysql_error());
    'Connected successfully';

    ("localhost""mysql_user""mysql_password") or die(mysql_error());
    "Connected to MySQL<br />";

    Also to see if display_errors is working for php (not the mysql part) just make an even simpler php file with 2 or 3 lines and test by messing up something. I'm sure you will see an error message generated.

Share This Page