I have an issue with a server and I don't know how to even start troubleshooting the problem.
I am using Freshizer which basically takes the users browser resolution and creates a copy of the images on the site that is suitable for that specific resolution. The idea is it saves on bandwidth, only ever downloading/displaying the smallest sized image necessary.
Anyway, I'm using it with a custom WordPress theme and it works perfectly on my XAMPP installation and also on my rented server but as soon as I transfer it all onto the site owners server it seems that freshizer doesn't create the image copies (everything else works fine).
I'm guessing the issue is with some kind of permissions to write? The folder/file permissions in the new server are the same as those on my rented server and they are both running Linux too. How can I confirm (or refute) this theory? Or how do I go about narrowing down the issue? ... as an extra, how do I fix it?
Related
I have an admin page that I want to make some changes. The website has been built using php and mysql, by someone else and it is up running.
First thing came to my mind was:
Download source code and make a local copy of everything and work on that and once finished upload to hosting again.(using Xampp)
I also have been advised to make another copy of server and make changes on the server instead of running it locally.
My question is: Second option seems much easier , but does that mean in order to test every little detail I have to save file, upload back to server and run it?
Am i missing something?
We recently had a web server fail on us. Luckily, by sheer coincidence, it failed the day after we did a massive backup and image of the drives, so all the data was saved.
Today I installed our backup server (exactly the same specs, with exactly the same make and model hardware) so we could get back up and running. Everything went well and the site is working, however, the images are not showing in the posts. I have confirmed they are all in their respective directories in wp-content/uploads, but none are appearing on the posts themselves.
The site was working perfectly before the server failed, and the backups and image completed successfully. The specs of the web server, control panel, phpmysql, or WordPress itself have not changed and everything should have worked as soon as the image was restored, but it doesn't.
WordPress version is 4.8.1, every plugin is up-to-date and there are over 3600 posts which I would rather not have to edit by hand...
Can anyone help me troubleshoot this images issue?
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.
I am working on a website. I do most of my development works from the localhost. Usually whenever I have to update the website, I delete all files on the server and upload everything from the website folder to the server. Previously, the files were less so it was not a problem, but now the files are large and it takes quite a lot of time to upload all files. Is there any way/software that would help me upload only the updated files? My website is based on PHP and MySQL. Thanks - this is my first post.
You should use any version control system to manage all such cases.
There are so many wonderful tools available for version control like GIT, SVN etc
You can try to work with Cobian Backup using an incremental Backup to the webserver. Just create a task and the program uploads everything that changed since the last "backup".
I’m using Zen Cart (PHP) for my web site. I have images that is on my supplier’s remote server and my site is on Host Gator the only way to get the images show up on my site is to connect to their server using links to the images (per agreement). They tell me that ZenCart PHP does not allow you to serve images from a remote host. And I need to have a PHP programmer take a look at the code to see if he can manipulate the source code to allow this. Does anyone have solution for this? Thank you!!
the other option is to sync images to a directory in your server from time to time (you can use rsync, wget etc.)
From glancing through the documentation it appears that ZenCart looks to see if a file exists in order to decide whether or not the image has a picture. PHP can do this over the internet, but it would mean that every time you opened a product webpage, there could be a dozen requests between your server and the supplier's server, just to see if image_MED and image_LRG and any other alternate images exist before your customer even gets to see the webpage, and then your customer would still have to connect to the supplier's server to get the image.
A programmer probably could alter ZenCart to remove all the alternate images, large images, image re-sizing and everything else that needs the actual image files to work, and allow it to use a URL hardcoded in the product database for the image. If you want to have large or alternate images, you'd have to have the programmer add those to the database too.