No images when switching Wordpress site hosts - php

Here's my problem :
I switched a Wordpress site from HostGator to MediaTemple. Since the domain name stays the same, I backed up and re-imported the database, downloaded and re-uploaded the site content without issues.
The first time, everything worked well except that in place of the images, I could only see question marks. Opening the image in a new tab would show "Not found". I went in the FTP and realized that the file names were in french and with accents in them like "é" and "à", and that in the process of downloading the files to my Mac (Using Coda) and re-uploading them in the server, the accents were all replaced by weird characters...
I tried to manually rename them, it did not work
I tried to do it using different Ftp apps, did not work
I tried using windows to do it, did not work
I managed by playing in Coda's preferences to change the encoding and to re-upload the files to the server while keeping all the accents but it still didn't work...
Database is in UTF-8, and I tried multiple collation like UTF8_bin and general_ci but it didn't work either...
I am pretty sure it is a character encoding issue since there is 1 or 2 images working on the site and they have no accents in their names but I really don't know where to look anymore.
Switched multiple Wordpress websites and never had this problem before, could somebody point me in the right direction please ?

In wordpress all the links are saved into the database and are not hard coded in the html files. So when you're shifting your website from one host to another, you must find and replace the previous host's links with the new host's links in the database file exported from the previous host before importing it into the new host.
Go to the following links for details.
How to Move WordPress From Local Server to Live Site
Moving WordPress - Wordpress Codex
Wish you good luck.

Ask your new hosting service to chown your files to your new account, which may be solve the problem.

Related

Wordpress Media Library does not display proper thumbnail

I have just migrated the website to new hosting and since then when I tried to upload new media files into the library, it always had HTTP error and media thumbnails are looking like in the attached picture.
I tried to find solution on the internet - removed and added new .htaccess file or added some code in it - none of these work. Has anyone ever faced this problem before? What's the solution?
Thank you,
Scott
This is a very annoying problem. In my experience, it causes due to three reasons;
Inappropriate folder permissions for wp-content/uploads folder.
If your site is using HTTPS through CDN like Cloudflare, it needs some additional configuration.
Another reason this might occur sometimes is if you change your theme or as in your case, the host. The solution for this one is to use this plugin Regenerate Thumbnails
You can share some more details for further discussion.
adding this as might help someone, an annoying error of my side.
Issue: migrated from localhost to a provider (in a fast maybe hacky way:)
exported the entire db from the local mysql (resulting in db.sql)
Changing the file db.sql:
changed the url 'localhost' to the domain, in the options-table (manually, typing it, the 2 rows)
replaced (as a String search-replace action) all localhost-links, globally (I used VIM :%s/localhost:8080/mydomain.com/g )
replaced (as a String search-replace action) the (default) table prefix "wp_" to 'mine': "mf_", globally (also VIM, as above)
Done with the db.sql. Now, uploaded (by filezilla) the files, recreated the db at the hosting provider by 'import' of the db.sql.
Did also: set all file and folder permissions as suggested in the web on many places. Did not forget to set stricter permissions for wp-config, and the 644 for .htaccess.
Issue: can access the application, can see (as admin) the media grid. However, all thumbnails were grey, and checking all suggestion as above and in other websites (like the access permissions) it seemed correctly set.
SOLUTION: In the table postmeta (!!!) there are attributes set to images, containing the text-part "wp". By changing the file db.sql globally, all "wp_" (the default prefix for the tables) to 'mine' ("mf_"), these attribute names were also changed.
(what i did then: exported the table postmeta and replace by VIM globally "mf_" again with "wp_", re-imported the table)
Please note: i am not a web developer and i am aware that it might not be the way supposed to be done, but it is the fastest, without much manual clicking around etc.
Maybe it helps someone, it happened a few times to me, so hopefully next time I myself will look into this stackoverflow answer, the idea of re-uploading the images (as suggested in several places) when they are already there is sort of daunting to me.

Moved Wordpress site to local server, now only header & footers display

I moved a copy of a site developed on a NFSN server to a local machine running WAMP. Everything works fine, except on all but the index page, only the header and footer appear. Help with this same issue (or very similar) has been been sought by other 2x before here, neither thread contains the cause or fix. The problem is independent of the theme used.
Edit: Have determined that the missing content is due to the fact that a plugin won't work (Elegant Builder). None of the typical responses to a misbehaving plugin have the desired effect, and there's another set of symptoms as well; the nav menus are scrambled and include some items not included on the remote site.
I copied the site to an alternate folder on the remote server, and just like when I copied the site to my local server, I used find/replace to update the links in the sql file before importing it to a new db--and got the exact same results as with the local site, so the problem is not with WAMP. It's either a problem with the db or with what I'm doing with the export file with find/replace (using Sublime).
You might have not used the find and replace tool properly. Do another find and replace tool without http and www with just the domain name and its extension to see if there items in the database which are not updated yet.
Also, recheck the domain name you replaced by doing another find and replace.

Moved wordpress : broken uploaded files with accents

I moved my wordpress website from my old server to my new. Everything works, except that every uploaded files (PDFs for example) with accents (é,à, and so on) in the file name got their URL broken. So I would have to rename every files with accents, and change my links that are pointing to these files.
The images are showing though. It really seems to be only affecting files with accents in the filename.
Any solutions for this? I just wanted to move the wordpress website to my new server. It worked, but I would have to rename all these uploaded files.
Thanks!
I had such a problem, i dont have 100% correct answer but i want help you.
I remember it was problem with ftp program (i dont remember, maybe winscp?)
anyway this program does not interact with server and changed accent characters. You can try do it with other program or from server shell.
Second thing, we known which character is wrong and my friend wrote plugin to change characters but if your have you problem from other side (char to accent) this cant work...
Find where is your problem, possible you can fix it with plugin like this: https://wordpress.org/plugins/clean-image-filenames/
Last important thing - check whether your database use correct encoding
Sorry for english ;)

Trouble with php code after moving from old windows host to new host running linux.

Recently we moved our site from old windows based host running an old php to new linux host running latest php/mysql.
I managed to fix quite few problems but there are two that are eluding me.
First one are non working numbers to switch to new "page" in our inventory.
e.g. -> http://adepto.hr/adepto_promotivni_artikli.php?kat=10&start=0
When you click on any of the above number nothing happens. It's same on all other categories. Here is page code. As I said, I managed to fix some errors that were caused by outdated code, but can't sort this one out.
http://pastebin.com/fbxZdgS5
Second one are the Croatian letters which are not showing correctly. ( e.g. čćšđž).
I'v tried declaring it in php files but without luck. What would be the correct way to declare/define this character set ?
Thank you,
Saturnij
I can't see where $start is instantiated. Looks like you're missing a $start = $_GET['start']
You should also be saving your PHP files as UTF-8 rather than ISO-8859-1 if you want good character set support.

Migrating Silverstripe CMS system from one server to another

Im relatively new to silverstripe cms and Im trying to move a site to a new host.
I followed all the instructions I could find on their official forums but to no avail.
Here is what I mean.
Here you can see what the site should look like
http://www.efekto.co.za
But this is what it looks like after I have moved it (copied everything to my public_html folder on the new site, set up the db username and passwords etc)
Please help cause I'm utterly and truly stuck at the moment.
Since someone else initialy moved the site so I decided to delete everything and move everything myself. Its hard to explain otherwise what I have tried or not tried.
First I tried to install just a base silverstripe. Got that right pretty much but only after I specified the database ip as 127.0.0.1 and not the external ip. So I deleted the base install again, copied over all the site files again and this time modified the db params to use 127.0.0.1 Some of the pages now actually reflect valid content but it seems that everything is not this light blue kind of color (seems to be a default of SS? ) It is as if it's missing some kind of master page or something as I can see content, but no module thingies like menus, blog section etc.
I also have to mention that to test this I change my hosts file so that www.efecto.co.za resolves to the sites new ip address with our new host. So from my machine it resolves to new ip but from the servers perspective when it fetches things like css its obviously going to fecth it from where www.efekto.co.za is currently hosted. Hope that makes sense?
So 1 step in the right direction at least. We have content and no more errors. Now whats up with this blue color scheme??
http://www.efekto.co.za seems to be fine now.
My guess: You've had a silverstripe-cache folder on your old server, which you've copied. It contains (as you might suspect) cached files with absolute paths. If your path structure is not exactly the same on both servers, you will run into problems. So always remove everything from the cache folder when moving sites around.
If that isn't the problem, take a look at the Apache log file (probably /var/log/apache2/error.log, but this can vary). As it's a server error, it should tell you what the problem is...
Check the error log in cpanel or whatever, perhaps a PHP or APACHE directive is different on this server. You'll find out from the logs what the problem is.
I got this once and the problem was that /dev/build wouldn't run because the php memory upper limit was set higher in SS than it was on the server.
Also go into _config and set the environment directive to 'debug', this will display as much output as SS can give you on the page.

Categories