PHP error, no data received - php

I keep getting this error:
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
I know it's part of my script, but I don't know which part. It divides certain text into a few different files, and those files are being created, but it's also supposed to zip them, but it's not getting to that part, so I have a vague idea of the general area the problem is occurring. I know this entire question is lacking detail, but I'm hoping that someone who has more experience with PHP and who may have seen the error before would be able to tell me what's happening.
http://gyazo.com/12ba55613011a115bb7507040f4d3ddf
EDIT: It works on Firefox... How can it be different between browsers if it's server-side script?

Restart apache and mysql
service httpd restart
service mysqld restart
Hopefully this answer helps someone.

It's a Chrome thing: http://www.google.com/support/forum/p/Chrome/thread?tid=7d50c093bd4f8f6c&hl=en

I don't know if you've already solved this, if it's a different problem causing the same symptoms or whatever, but yesterday I noticed this same error on my development machine, running Apache+PHP+MySQL under Linux, when accessing my local phpMyAdmin:
http://localhost/phpMyAdmin
It was running fine until that day, and I realized that by the same time I changed some settings related to sessions in my php.ini.
The problem was caused by having session.save_handler set to user instead of files. So I switched back to
session.save_handler = files
and voilà... everything is working fine again.
Also be sure to have set the proper session.save_path. In my case, and probably in most Linux systems,
session.save_path = "/tmp"
Be sure to set the proper permissions to that directory, too. Mine is chmod'ed to 777.

A little late to the draw here, but I received this error while working on a local copy of a php project (on Chrome), and although Firefox loaded some parts of the pages, it was still throwing similar errors.
The really weird part was that if I commented out includes or a few functions it would load partially.
I got around it by restarting the local server. I was using MAMP. You can tell for sure that this is the issue if you're running MAMP by going to the home page - it'll likely throw the same error.

tail -f /opt/local/apache2/logs/error_log
(or wherever is your apache2 install..)
... Will likely help you to spot where the problem lies in your PHP script. At least it did for me when facing the same problem (No data received, whatever the browser).

I was getting this issue intermittently in Chrome. For me, reloading the page would get a successful (non-empty) response, but it would sometimes take up to 3 or 4 reloads of the page. To handle this, I added the $.when(), .done(), and .fail() jQuery functions to my AJAX request. If the request fell into the .fail() function, I ran the location.reload(); js command to get the page to reload. Otherwise, I called a function that did the rest of my page loading in the .done() function.
This has the potential to create an infinite loop with the page never receiving a successful AJAX response and continuing to reload forever. So only try out this method if this issue is intermittent. If you are unable to get a successful AJAX response at all, then this method will not work for you.

Related

how can I fetch 300K records from PHP MySQL server without LIMIT? [duplicate]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am getting "500 Internal Server Error" when I used ajax call. What is causing this problem? How to resolve it?
debugging, fixing, and resolving a server error from an Ajax call is exactly the same process as any other request.
Check the web server error logs for any indications of what the error is
Introduce debug statements into the serverside code around where the error is occuring (and add a little bit to your ajax request to dump all the response as plain text)
It may also be useful to copy the URL and querystring used in the Ajax call and paste it into your browser to view any responses.
Firebug for Firefox is also a useful diagnostic tool for testing what is being sent as part of the Ajax call and what is being sent back as a response.
Use fiddler or firebug to look at your network request/response.
It looks like you may be using perl?
Try adding use CGI::Carp qw(fatalsToBrowser); on a new line after your path to perl declaration.
I was working on a customer's server and had problems executing PHP code. I checked on the CPannel the errors and it was just a permissions error.
The PHP files had to be set with non writable permissions for groups.
In my case setting the permissions to 644 got everything working.
If your server is running Windows, then look in the event log and see what server error occurred.
Look in the server log, which on Linux is normally in something like /var/log/apache2 or /var/log/httpd.
Download Firebug, intercept the ajax call and load it in the browser or look at its output. Make sure you server is set to report errors (look at php.ini for PHP settings, for example). Whatever is causing it is probably going to show up.
Make sure you don't actually throw the error 500 yourself in the code.
If you use PHP, then use a debugger, such as PHPEd or xdebug and step through the code. That's the way I debug my PHP and it's the best way, though takes some time to set up.
You created and fired off a request to a server with whatever you did in Ajax. So far, so good. The server tried to process your request but ran into an error condition. That's usually caused by some bug in the server code.
As John Saunders advises, you can usually get more information on the server-side problem by looking into its logs.
My step usually (in particular order):
open firebug and look up the particular ajax request from console. Then, see the parameter, header, and URL request. Examine each data to see what goes wrong. If it all seems OK
I will look at my server log (httpd-error.log on Apache) and check any particular error that came from that request.
Fix what is wrong based on all there checking.
I was also facing the same error today. It mostly occurs because of wrong folder/file name because name of folders and files when linking/ sending ajax requests is case-sensitive on actual servers (not in Server simulators e.g. WAMP/XAMPP). So, check your file path to which you are sending the request and the problem may get solved.

net:err_connection_reset after loading php file completely

I have a quite simple php page (PHP 5.5.35 on CentOS 5.11) that queries a MySQL database. The resulting page shows completely, including the footer I include as a final instruction, so the PHP script runs entirely without error.
Almost every images and js libraries are loaded. However, there are two elements that are never loaded, an image and a jquery library. Each time and with any browser, those elements generate a (in Chrome, for instance) :
Failed to load ressource : net::ERR_CONNECTION_RESET
For testing purpose, I tried to delete those element from the page, ultimately, it is the favicon that can't be loaded. So it seems not to be those elements in particular. The connection seems to be reseted at some point between the PHP script completion and the page loading… and I don't have the beginning of any clue where I should start the troubleshoot.
Some other informations :
Apache logs don't log anything !
The other pages of the site works well
The site works without any problem on my local machine (Mac OS X, PHP 5.5.35 too)
Once the page is loaded, if I click any link on it, it shows a "Connection reseted" error page.
Does anybody have a clue, anything about where to start my search ? Thanks in advance, I am starting to desperate.
It happened that after searching everywhere, the cause was simply that I was handling a lot of parameters through GET – too many of them. I changed the code for using POST and everything worked miraculously… Hope it may help someone, sometime !

PHP session not working properly on server

This is a weird problem and I really don't know how to explain it so please bear with me. The thing is I have a php project which has been coded from scratch(no template engine or frameworks), and it works fine on localhost, but as soon as I upload it on server, for some odd reason, the pages and session data seem to arrive from a cache. For example if I try to delete a value(by submitting a form), the page loads and still shows the value, if I then hit Ctrl+F5(force reload on FF), it loads correctly showing( or rather not showing) the deleted record.
Can this happen due to any server-side settings?
Try and clear all sessions from your browser. I have experienced something similar, it could be sessions set by your local host on the browser that is conflicting with it.
Try and set cache for php files to 0 using htaccess.

PHP Page forced download IN ERROR

This is a strange problem but it happens enough that I wanted to ask.
For some reason, sometimes the browser will force a php page to download to the browser and it always comes up with 0 bytes.
Mind you, I'm not trying to force the download and I'm very familiar with headers and forcing files to download intentionally, what I'm talking about is an issue where the browser can't process the page and thus it spits it out as a forced download.
One Example: I've got phpMyAdmin 2.3.2 running on a PHP4 server and a PHP5 cloud server. On the PHP5 cloud server, if I click "browse" on a table it tries to spit out sql.php as a download and it comes out empty.
I know the details are vague and I don't expect a solution as much as some ideas in where to look or possibly if someone else has experienced the same thing.
BIZARRE UPDATE:
When the URL has the word "Select" in all caps it breaks.
Works:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=Select
Breaks:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=SELECT
Noodle that one!
ANSWER:
As it turns out, the words SELECT, UPDATE and INSERT (yes, all caps) are blocked words on The RackSpace cloud. You cannot pass these via a GET request, only POST.
However, if you change them to Select, Update and Insert they work just fine. Seems they are not blocking everything.
I have seen that when I'm trying to access a server to which I don't have a valid network route. For example, I set a tunnel proxy in Firefox, through ssh. Then try to connect to localhost - I get a download of a 0 byte PHP file.
The download is happening because it has an extension of PHP, with no content, and the server is not sending you a MIME type, so the browser doesn't know how to handle it, and reverts to a download.
Sounds like a server misconfiguration.
PS. stop using PHP 4.
In my experience this sometimes comes with a segmentation fault of the webserver, due to php scripts behaving badly (the foo(){foo();} kind of crash)
segmentations faults are logged in the apache error log.

Apache comes back with nothing

I'm running Apache 2.046 with PHP 5.x and I am experiencing very odd behavior on a CodeIgniter app.
The frustrating thing is that it is not consistent.
Occasionally when I call up my app Apache returns nothing. I mean nada. But then I hit refresh and everything works as expected. Sometimes I have to hit "refreash" several times before the page will load. Other times it comes right up. When I started this post it was happening 80-90% of the time. Now I can't seem to make it happen. But it's been happening for several days so I have confidence in the next couple of page visits I will see it again.
This is on a development box that has very little traffic. When I do a PS I see several HTTP threads running - "top" reveals nothing un-expected (like a runaway process).
When I tail the apache access logs I don't even see a logged request when Apache returns blank. No Apache or PHP errors are being thrown.
I mention codeIgniter mostly because we're using the recommend .htaccess file with Mod Rewrite. So I wasn't sure if that was contributing to the issue. It also does not seem to be a problem with non-codeIgniter apps. That's hard to say with confidence since the issue is so inconsistent.
It does not seem to be client issue as we're seeing this happen from multiple client machines.
I can't tell if this is a server (hardware) issue, Apache issue or coding issue. Maybe it's a memory issue?
Any thoughts?
NEW INFORMATION:
IN the PHP log file I received this:
PHP Fatal error: fatal flex scanner internal error--end of buffer missed in /data/www/coreLib/codeIgniter/system/libraries/Hooks.php on line 226
Blank pages when using CI are usually caused by php errors with error messages suppressed.
Try re-enabling them and reloading.
error_reporting(E_ALL|E_WARNING)
If you suspect your Rewrite rules are the source of the problem, then crank mod_rewrite's logging level up and find out. Otherwise, the fact that everything works normally outside of your app makes this sound like it's a problem with your code or possibly the framework itself.

Categories