All Products 
Username / Customer#
Password
Log In
 Hi,  |  Log Out
  • Site Search
  • Domain Search
  • WHOIS Domain Check
24/7 Support: (480) 505-8877
Hablamos Español
9 AM to 9 PM IST
7 days a week
Go Daddy Support

Search help articles, forums, and discussion groups

PHP MySQL Fetch — 500 Internal Server Error

Viewing post 1 to 4 (4 total posts)
Profile picture of rbanerjee

rbanerjee said 1 year, 1 month ago:

Hello,

So I have a weird error where if I fetch more than a certain number of rows from a mysql table, it triggers a 500 Internal Server Error.

I am using Apache Web Server (through GoDaddy) and the offending code is below:

set_time_limit(0);
$this->Connect();
$Output = array();
$search = “SELECT * FROM <table> WHERE user_id = ?”;
if($Statement = $this->MySQLi->prepare($search)){
$Statement->bind_param(“i”, $UserId);
$Statement->execute();
$Statement->bind_result(<result variables>);
$count = 0;
while($Statement->fetch() && $count++ < 70){
ChromePhp::log(<result variables>);
}
$Statement->close();
}
$this->Disconnect();

ChromePhp::log is a way of dumping things to the Javascript Console in your browser from within a PHP script just as a heads-up. So when I set the stop number as 70, everything is fine. If I try to fetch more than that it triggers a 500 internal server error on Apache Server port 443. I have looked through the error logs and can’t figure out the cause but this is almost certainly a server configuration issue? I’d appreciate any feedback, especially anyone familiar with GoDaddy’s hosting services

Thanks

Profile picture of TimB

GoDaddy Expert timb said 1 year, 1 month ago:

@rbanerjee

I am not familiar with this issue or why there is a discrepancy with results based on the stop number. What did you find within your error logs? Perhaps another forums user can offer some suggestions with this information.

Tim B

Profile picture of rbanerjee

rbanerjee said 1 year, 1 month ago:

So my error logs report the following error:
Apache Error: Premature End of Script Headers

Using this source http://kb.liquidweb.com/apache-error-premature-end-of-script-headers/

I think the problem is a resource error. I don’t think my code is the problem because as I noted, it works up to a certain number and then dies which points towards a server settings issue.

Profile picture of TimB

GoDaddy Expert timb said 1 year, 1 month ago:

@rbanerjee

To determine if the cause of the error is due to a resource issue, please contact our Support Team and reference this thread if you have not already done so. I’ll make sure that our support team reviews the issue as quickly as possible.

Tim B

Add a reply:

You will auto join this group when you reply to this topic.

When posting about a technical issue, please be sure to include as many details as possible, such as your domain name, related URLs and other pertinent information. This consideration will allow us to better understand the situation and quickly assist you.