PHP page loads partially - php

I have a couple of websites which load no problems on almost every computer/device I have tested them on. However, when I try to load certain pages within either of these sites on my work PC from within the corporate network both websites produce some but not all of the HTML output. They both stop at the same point each time. There are no errors reported from PHP.
If I use my work PC but disconnect from the corporate network and tether my phone to the PC I can again load the page no problems.
My question is, what settings within the corporate network would likely be causing this partial HTML output? I am assuming some kind of time-out (although the fact that they always stop at the exact same point of their output suggests something more like a length issue). What I really need to do is understand how I can replicate the issue on my dev computer so that I can put in some handling for when the issue might appear. Any ideas?
Thanks.

Should be the proxy or caching setting of your corporate network.
You can check by inspecting the header of the http responses, for Chrome you can go to Network panel in Developer tools and check individual requests and responses.

You are most likely not seeing the error because there is no error. I'm thinking that you are using a exit() function which is not showing rest of the page, you may have an if statement which is stopping the computers from corporate network accessing the rest of the page.

Related

wordpress err_connection_reset in Chrome from specific country

I volunteer supporting a news website in Russia, which was hand-crafted in PHP back in 2002-2004. Needless to say, I was super excited when editors hired some folks to build a new version, based on WordPress.
The old site is running on mydomain.press. I put the new WordPress version, which is meant to replace the old one, on subdomain.mydomain.press.
And there's a mysterious problem with it.
When an editor is trying to access the site at subdomain.mydomain.press, her browser (Chrome in Russia) instantly reports err_connection_reset, in 9 cases out of 10. Not spinning trying to load the site - an instant error is reported.
On my machine (Canada) the same website opens no problem. Well, a little slow (hence I mentioned she's not even seeing the delay - the error is instant), but it opens in 10 out of 10 trials.
When her Chrome gets the content (in that 1/10 case), it also shows a slight delay. Only the error case is instantaneous. The old site at mydomain.press is opening 100% of the time.
Connecting remotely to her Windows machine (I'm using Mac OS X) via TeamViewer, I did observe the behaviour described when using Chrome. Interestingly enough, IE didn't show this problem - it loads consistently, except that once in ~10 reloads the page loads with a garbled styling. As if some css isn't loaded properly (but not in a way that would make it an invalid document, obviously).
I'm completely out of my depth. I tried disabling her Windows Defender to see if it's the culprit - nope. I've tried to reset her IP address (as suggested by the same page which offered the earlier way to try and fix the err_connection_reset) - no dice.
I'm not seeing either error from my own Chrome, nor the garbled css (though I didn't try with IExplorer from Canada).
I know they had some ISPs in Russia block them (silly political reason, AFAIK) in the past - but this doesn't look like blocking; she'd be 100% unable to view it otherwise. She's not under any firewall (nor is the website).
what else... nginx is the server used, the setup is "basic", I suppose (I'm not that proficient in configuring it to try anything fancy).
And to make things even more mysterious - the website at mydomain.press (the old version, php-hand-crafted) is opening just fine, 100% of trials.
Opening using the IP-address doesn't change the picture, so doesn't look like a DNS issue.
Any ideas?
There is an ongoing battle of Roskomnadzor against Telegram messenger in Russia, which affects subnets, DNS and DPI hardware around the country. Try to connect via proxy or VPN server outside Russia and see if the problem goes away.

Images Fail to Load, net::ERR_CONTENT_LENGTH_MISMATCH

Problem
When you load up a page on my site, often times one (or several) images (jpg files that I have saved from Lightroom and/or Photoshop) will not appear. It instead looks like a broken link (ALT description appears) but no image. Hard reload of the browser solves problem (e.g. all images load properly after a hard reload).
Error Message
Chrome displays an "ERR_CONTENT_LENGTH_MISMATCH" warning for all images it does not load. (Sometimes the image will flash quickly before going to what looks like a dead image)
Setup
Running latest version of Wordpress (4.2.2) on a Shared Host. Site is SSL (https) if that matters. Images are located in an image upload folder (nothing complex like Imagemagick, etc) on the host.
My Troubleshooting
I have replicated the issue from multiple locations using various ISPs on various machines (both Mac & PC) and with various browsers (Chrome & Safari) some of which are not using any ad-blockers.
What I've tried is the following:
I asked the host if there was an issue on the server side. They claim no.
I've tried resetting the functions.php file. No impact.
I've disabled all plug-ins. No impact.
I've hardkeyed in the meta charset as UTF-8. No impact.
Checked if I'm using Gzip. I am not.
Enabled Wordpress Cache plugin. No impact.
Cleared .htaccess of all non-necessary redirects & commands. No
impact.
Replaced wp-admin and wp-includes folders from fresh install. No
impact.
Deleted Wordpress & Reinstalled from a Backup. No dice.
I've put source code from pages that have this issue into a test.html file and the images seem to load up fine doing that.
My Thoughts & Questions
The images are 100-200kb each and sometimes there are a fair amount of them on the page. Is something timing out and then once I hard reload, everything show up because the timeout isn't tripped? That is the best random guess I can gather without understanding the issue perfectly.
Any ideas of things I can try? Should I delete the whole database and start again? Everything I know about computers is self-taught and server issues are not a strong point for me. Even if you don't know what it might be, could someone explain what a content length mismatch is in general terms?
Thanks much!
When you request data from a web server, it responds first with some information about the data (HTTP headers) and then with the data. One of these pieces of information, an HTTP header, is called Content-Length. It tells the client how much data it should expect to receive from the server. When your browser gets an image, the server's response (very simplified looks like)
Content-Length: 100000
< the image, 100000 bytes of data >
The client knows the request is complete when it has received the amount of data told by Content-Length. Until it receives in this case 100KB (100000 bytes), it considers the image, for example, to not be done loading.
If the server breaks the request before the client receives the data from the server, or if the client receives more data than it received, the client will throw some sort of error and assume the data to be corrupted/unusable and dispose of it. How this is handled can vary between browsers.
How did you upload the images to your website? Myself, I have encountered this problem in a situation where the file's supposed size was stored in the database, and this was used to set the Content-Length header. The file size in the DB wasn't correct for the file. HOWEVER, I know that WordPress does not store file sizes in the database; media uploads are simply represented by a URL.
This could also happen if the web server runs out of resources and can no longer fulfill your requests; you said you had lots of images per page. If you are on a really lousy shared hosting plan, it may be the case that the host imposes limits, or that the server simply can't handle the traffic of all the sites it hosts.
I wanted to circle back on this in case someone else is experiencing this problem. It appears that there is some type of glitch between HTTPS and image retrieval that was causing the problem. While I don't understand WHY that is, I converted my site from SSL/HTTPS to simple HTTP (which I was able to do as it doesn't require encryption) and it appears all images load as they should.
If someone understands the "why", I'd love to understand what the issue actually is. Luckily, I was able to come up with workaround. So, while this doesn't answer my question, it does provide context of what is causing the problem and my common sense workaround.
You might see this problem with a shared hosting service. Free bandwidth is like free speech, not free beer. Resource outage policies are invoked during traffic spikes.
A distributed system architecture solves this by inserting a front-end CDN tier (eg. CloudFlare). CDNs cache your static resources and can vastly reduce the load on your host. In fact, for completely static sites the host can be shut down.
There are other advantages to CDNs, like attack detection, free SSL (not beer) and overall improved performance and security compared to shared hosting alone.
Many CDNs are free (as in speech). You could also upgrade to private hosting, but $ and you still might want a front-end tier.

PHP cURL function

We have develop a CURL function on our application. This curl function is mainly to map the data over from 1 site to our form-field in our application.
However, this function has been working fine all the while and ready for use for more than 2 months. Yesterday, this fucntion was broken down. the data from this website is no longer able to map over. We are trying to find out why the problem is. When we troubleshooting, it shows that there is response timeout issue.
To re-ensure there were nothing wrong on our coding and our server performance is working, we have duplicates this instance to another server and try out the function. It was working perfectly.
Wondering if any one out there facing such problem?
What could the possibility to cause this issue?
When we are using cURL, will the site owner know that we are calling their data to map into ours server application? If so, is there a way that we can overcome this?
Could be the owner that block our server ip address? tht's why it function works well on my another server but not in the original server?
Appreciate your help on this.
Thank you,
Your problem description is far too generic to determine a specific cause. Most likely however there is a specific block in place.
For example a firewall rule on the other end, or on your end, would cause all traffic to be dropped, thus causing the timeout. There could also be a regular network outage between both servers, but that's unlikely.
Yes, they will see it in their Apache (or IIS) logs regularly. No, you cannot hide from the server logs - it logs all successful requests. You either get the data, or you stay stealthy. Not both.
Yes, the webserver logs will contain the IP doing all the requests. Adding a DROP rule to the firewall is then a trivial task.
I have applied such a firewall rule to bandwidth and/or data leechers a lot of times in the past few years, although usually I prefer the more resilient deny from 1.2.3.4 approach in Apache vhost/htaccess. Usually, if you use someone else's facilities, it's nice to ask for proper permission - lessens the chance you get blocked this way.
I faced a similar problem some time ago
My server IP was blocked from the website owner
It can be seen in the server logs. Google Analytics, however, won't see this, as cURL doesn't execute javascript.
Try to ping the destination server from the one executing the cURL.
Some advices are:
Use a browser header to mask your request.
If you insist on using this server, you can run trough a proxy.
Put some sleep() between the requests.

Sites up and down Intermittently with 'No data received' Error code: ERR_EMPTY_RESPONSE

I'm not very technical so apologies up front! Unfortunately, I've been left to figure this out though as the company who deal with my dedicated server are being less than helpful.
Really hoping someone can shed some light on this. We host around 100 websites and currently, all sites on our server are up and down like yoyos. There doesn't seem to be a pattern - it's very sporadic and intermittent. Usually, you can just click around one of the sites, for example www.innivo.com for a few mins and you’ll see the site drop out, and then after a few refreshes, it will come back, then back down – you get the idea.
In Chrome, I get: No data received
Unable to load the web page because the server sent no data.
Error code: ERR_EMPTY_RESPONSE
In Firefox I get:
The connection was reset
The connection to the server was reset while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
The server doesn’t go down completely, it just doesn’t seem to serve the page. This also agrees with the firewall theory I mentioned on the call.
We have paid a lot of money to a security company who have removed a few bits of malware in the hope that it would fix the problem, but they now say that the server is completely clean and exploit free. My service provider is saying they won't help until I upgrade PHP on the server but although I'm going to do this, I'm pretty sure that this won't fix the sites dropping out all the time.
I found this post which describes EXACTLY what is happening, but he doesn’t really say how to fix it, or even if his ever got fixed but it’s the closest thing I’ve found!
http://progblog10.blogspot.co.uk/2013/09/modsecurity-causes-sporadic-no-data.html
I looked for this on the server but mod_security didn’t seem to exist otherwise I would have tried to disable it to see if it made a difference. I think though, that this firewall theory sounds plausible. I wonder if we have some other type of firewall which was maybe activated or updated when we updated CPanel last week.
I'm running WHM / CPanel / Apache
Any help would be massively appreciated. Hoping that this has happened to someone else!
My personal experience. I have xplornet. I was unable to access a local site with none of my browsers. I have my computer, my Hughes, my printer, my monitor all plugged into a power bar. I shut off the computer, Unplugged everything including the plug in on the back of the hughes. Left it for a few minutes then plugged everything back in into different outlets on the power bar. I was able to access the site after that. Why I have no idea but it worked.
ive been struggling with this error and i think i have found the solution . I ran my website on local host( MAMP ) . Its worked fine so i called my hosting provider and they said i needed an upgrade cos my existing account did not support simultaneous connections . So i upgraded and its perfectly working

What can cause a website to not always load

Roughly about 20% of the time when clicking on links in my website (www.slr-lens.co.uk), the site completely fails to load. I have tried removing and adding all code segments but to no avail... I've also asked the web hosts, but apparently the server is working normally.
Does anyone have any suggestions about what could cause a web page to sometimes not load? E.g. any specific lines in the php.ini?
The site uses sessions, and there's quite a lot of mysql action for each page load.
Internet explorer will say:
"Internet Explorer can't load this page"
Google chrome will say:
This web page is not avialable: Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
Firefox will sometimes only show a blank page.
Sorry for being so vague but its a really vague problem!
Thanks
The answer (or at least a clue) likely lies within your PHP / Apache error logs.
It could be your Apache logs or you just have a bad host. Either way, it seems to load every time here (10+). Have you tried replicating this problem somewhere else?

Categories