I’ve been tasked to complete what appears to be a migration of a WordPress site from a development URL (/newblog
) to a production URL (root) that seemed to have already been attempted by somebody else and got messy somewhere along the way and am seeing errors I have never seen before.
After seeing some really strange things (I tracked down an error earlier that involved me simply resaving a file with the same contents – it was as if some kind of cache was in operation), I got an error like what I pasted below (obviously examplesite.com
is a made up domain).
What I don’t understand is that there is no such directory called /newblog anymore, so how can it be saying the error is found in /var/www/examplesite.com/newblog/wp-content/plugins/akismet/widget.php
?
I’ve checked the database and there is no reference to any path with /newblog
in it.
Warning:
include_once(/var/www/examplesite.com/newblog/wp-content/plugins/akismet/widget.php):
failed to open stream: No such file or directory in
/var/www/examplesite.com/newblog/wp-content/plugins/akismet/akismet.php
on line 49Warning: include_once(): Failed opening
‘/var/www/examplesite.com/newblog/wp-content/plugins/akismet/widget.php’
for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in
/var/www/examplesite.com/newblog/wp-content/plugins/akismet/akismet.php
on line 49Warning:
require_once(/var/www/examplesite.com/newblog/wp-content/plugins/jetpack/class.jetpack-user-agent.php):
failed to open stream: No such file or directory in
/var/www/examplesite.com/newblog/wp-content/plugins/jetpack/jetpack.php
on line 4467Fatal error: require_once(): Failed opening required
‘/var/www/examplesite.com/newblog/wp-content/plugins/jetpack/class.jetpack-user-agent.php’
(include_path=’.:/usr/share/php:/usr/share/pear’) in
/var/www/examplesite.com/newblog/wp-content/plugins/jetpack/jetpack.php
on line 4467
Using your example path:
This fragment of that path:
Is basically the base install path that is usually stored in
wp_options
insiteurl
,home
,dashboard_widget_options
and even others. But when it comes to migrating an installâlike what you are attempting to doâit can really get in the way.The issue is that WordPress attempts to make initial installs so simple, they make them hard to migrate. The best solution that I use on a regular basis is to hard-code the install paths within the
wp-config.php
file like this:Of course, the settings I have set above are based on my best guess of your setup. Assuming a standard Unix
/var/www/
install path and your site URL. But in generalâand in my experienceâsimply setting these paths explicitly in yourwp-config.php
is the best way to go to migrate a site & even make it more portable.Also, check the
.haccess
file. It should basically be:But if someone placed the site in a directory on the server that is not the rootâlike
newblog
âit could be something like this:Note the two places where
newblog
are in that example above. But from what you describe it all sounds like a config issue.And if worse comes to worse, I recommend you figure out what version of WordPress the site is usingâlook in the file
/wordpress/wp-includes/version.php
âand then download a clean install of WordPress, set the config to load the old/damaged siteâs database & such & then copy thewp-content
folder from the old install into the new install. Hopefully the previous developer did not muck with the WordPress core files, so just copying thewp-content
& using the old directory should help you out.