MySQLi Error 404

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by jordan85, Jan 21, 2015.

  1. jordan85

    jordan85 New Member

    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I'm currently working on some PHP scripts and am having trouble that I haven't been able to find an answer to.

    Code:
    $conn = new mysqli($servername, $username, $password, $dbname);
    ...
    echo $conn->error
    Whenever I use $conn->error, I get redirected to my custom 404 page. It doesn't change the location of the page, but just basically refreshes the page and throws a 404 error. Google isn't giving any answers. Am I missing something with my hosting plan?
     
  2. essellar

    essellar Community Advocate Community Support

    Messages:
    3,295
    Likes Received:
    227
    Trophy Points:
    63
    Yes - there are security settings in place meant to keep you from "leaking" debug info to the world; a 404 will be thrown if the response is "leaky" (a 403 if the request content is "shady").
     
  3. bdistler

    bdistler Well-Known Member Prime Account

    Messages:
    3,534
    Likes Received:
    195
    Trophy Points:
    63
    with the new x10hosting's security mod_security hammer and no log files
    we (users) now need to test our PHP/MySQL scripts on some other host to find where the error is at and what it is
     
  4. essellar

    essellar Community Advocate Community Support

    Messages:
    3,295
    Likes Received:
    227
    Trophy Points:
    63
    You're not supposed to be doing development in a production environment, ever. It may be your playground, but it's the "real deal" for the vast majority of users of the service, and production website hosting "for the masses" is the intent of the service. Free Hosting is not, and was never intended to be, a staging area for development experiments.
     
  5. bdistler

    bdistler Well-Known Member Prime Account

    Messages:
    3,534
    Likes Received:
    195
    Trophy Points:
    63
    my point is - when we (users) have a issue come up with our site (account) that was working - we no longer have any information as to why it stopped working
    so now we need to test our scripts on some other host to find where the issue is at - and what the issue is - before the issue can be resolved
     
  6. caftpx10

    caftpx10 Well-Known Member

    Messages:
    1,492
    Likes Received:
    106
    Trophy Points:
    63
    I agree with the others.
    Regardless if production or not, there should be information so that any issues can be identified and potentially be corrected (especially if it's a typo in the code).

    Without the error being displayed, how would the issue be corrected (easily)?

    An example would be a MySQL connection error of some sort (this can be due to failing to connect with the details provided, IP blocked, max connections..), as it's 'localhost,' you can't really figure out the actual issue on a different server, as the host URI is literally local ('localhost' assigned with a local IP in the hosts file).
    Would it really be worth importing a database just for simple debugging rather than just looking at the error right away and sort it out?

    Many hosts (paid or not) display the errors either in a log file, outside to the public (worst thing to output) or both.
    Like @bdistler said, we would prefer to not use a secondary host just to hunt down the cause of the issue, small or not.
     
    Last edited: Jan 22, 2015

Share This Page