PHP error, no data received

2020-02-10 05:04发布

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?

标签: php
6条回答
闹够了就滚
2楼-- · 2020-02-10 05:13

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2020-02-10 05:16
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).

查看更多
走好不送
4楼-- · 2020-02-10 05:18

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.

查看更多
冷血范
6楼-- · 2020-02-10 05:32

Restart apache and mysql

service httpd restart

service mysqld restart

Hopefully this answer helps someone.

查看更多
smile是对你的礼貌
7楼-- · 2020-02-10 05:36

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.

查看更多
登录 后发表回答