# Any Wordpress experts?



## balanga (Feb 26, 2017)

Apologies if this isn't a FreeBSD question, but I'm trying to copy a Wordpress website using Duplicator and get an error when building a package. I have no idea what is causing the error or how to debug it. All the YouTube videos make the process look extremely straightforward.

I am hoping to migrate the website from Linux to FreeBSD, so it is slightly related to FreeBSD.


----------



## lostpacket (Feb 26, 2017)

I normally use a different plugin for this, have used it a lot and it works well, search for "all-in-one migration". Does have a limit of 512mb for the maximum site size but it's hard coded in the config file and easily changed if needed.


----------



## balanga (Feb 26, 2017)

Thanks for the suggestion. I installed it and it created a 2GB export file, but import limit is 512MB as you mention...

I've looked through the code but haven't managed to find where $allowed_size is set. A hint would be useful... Or maybe I'll just comment out the check...


----------



## lostpacket (Feb 26, 2017)

/wp-content/plugins/all-in-one-wp-migration/constants.php

Change:

```
define( 'AI1WM_MAX_FILE_SIZE', 536870912 );
```
to:

```
define( 'AI1WM_MAX_FILE_SIZE', 4294967296 );
```


----------



## balanga (Feb 26, 2017)

Thanks, I just found it - I had been looking for '512' .

Unfortunately, after Importing, it says

*Unable to import*
The archive file is corrupted. Follow this article to resolve the problem: https://help.servmask.com/knowledgebase/corrupted-archive/


----------



## lostpacket (Feb 26, 2017)

Haven't see than myself, only problems I have ever had with that plugin have been down to not enough disk space to create the archvie.

Would be simpler just to mnually archive the web folder and dump the sql, restore at other end?


----------



## balanga (Feb 26, 2017)

If only I knew how.... I'm just trying to make a local copy of a Wordpress website for a friend. I wasn't involved in building the website and only have access to wp-admin.  Everything I've read about copying such a site with a plugin made it sound very straightforward.


----------



## usdmatt (Feb 26, 2017)

I'm not much of a Wordpress guy but I've just been through this for a customer.

I tried a few options and they either didn't really work (Duplicator) or had free limits that weren't big enough for the site. I did try just copying the files and db manually, then doing a search and replace in the db for the old URL. That seemed to work but I had weird issues with the theme.

In the end the customer agreed to buy Updraft which seemed the most robust backup/migration plugin to me. As it happens I had the exact same issues with the theme when I used this to move the website. I ended up using a feature in the theme admin to copy the theme config over which seemed to fix it, so seemed like a weird theme bug and my manual copy probably would have worked.


----------



## lostpacket (Feb 26, 2017)

It should be simple enough using the all in one tool I mentioned, I had to do it recently to move a lot of sites for a client. Did you try redoing the export? did you check the both versions of Wordpress are the same?


----------



## balanga (Feb 26, 2017)

I tried redoing the export, and got the same result on the import. Both systems are running WP 4.7.2.

I did notice an import.log  which mentioned a "secret_key" so I'm wondering if should have the same "secret_key" configured on the target system. Just a thought....


----------



## metsuke (Feb 27, 2017)

As usdmatt said, a manual copy should have worked for him if not for a theme bug.

I use Wordpress as well, and would recommend a manual copy, as it has worked for me in the past without an issue.  Unless some plugins are doing strange things, you _should_ just be able to copy the root directory of Wordpress and the database over to a new system, modifying only the address of the database in Wordpress (and not even that if it is localhost).


----------



## ShelLuser (Feb 27, 2017)

I don't get it: why use a plugin? All you need is a dump of the database and a copy of the actual working directory. So basically a `# mysqldump --opt -u root -p wpdatabase > dump.sql`. If you don't have root privileges you can use whatever local account you have of course.

Then copy that out of the way and archive the base folder (for example: `tar cvjf /usr/local/www/wordpress /home/me/wordpress.tar.bz2`) and copy that out of the way also.

When done you might need to edit wp-config.php to meet the (hopefully) new database credentials as well as a new set of secret keys (look here) and you should be all done.


----------



## lostpacket (Feb 27, 2017)

ShelLuser said:


> I don't get it: why use a plugin?





balanga said:


> I wasn't involved in building the website and only have access to wp-admin.



He's using a plugin because he doesn't have access to the server to copy the files and dump the data.


----------



## balanga (Mar 7, 2017)

I got the site developers to create an archive, now I'd like to restore that archive on FreeBSD. Should I simply extract the archive in place of the Wordpress site already created?


----------



## lostpacket (Mar 7, 2017)

pretty much, `mv` the folder of the one you are replacing, extract the files, import the database (ensure you have updated the sql details in wp-config.php). Should be good to go.


----------



## masteroman (Mar 8, 2017)

balanga said:


> I got the site developers to create an archive, now I'd like to restore that archive on FreeBSD. Should I simply extract the archive in place of the Wordpress site already created?



Yes, move website files to appropriate webroot directory, create empty database:

`mysql -e "CREATE SCHEMA 'yourdb_name'"`

Create user and give appropriate rights to it:

`mysql -e "CREATE USER 'youruser'@'localhost' IDENTIFIED BY 'yourpassword'"`

Grant privileges to all tables in database and flush them afterwards:

`mysql -e "GRANT ALL PRIVILEGES ON yourdb_name.* TO 'youruser'@'localhost'"`

After that just import database:

`mysql -u youruser -h localhost -p yourdb_name < /path/to/yourdb_name.sql`

Edit your wp-config.php file to have correct connection string and that should be it. If you're using some sort of caching plugin make sure to empty cache or remove cache folder all together afterwards.


----------



## balanga (Mar 8, 2017)

I'm getting there.... not sure that I successfully entered those commands as I should have, but I get the home page albeit with a 404 included, but I'll investigate that further. I also get a lot of redirects to the original site, which I guess means a lot of editing.

In the second command above can I change 'password' in wp-config.php to match 'yourpassword' when I create the user? And does it need to be the same user as that originally created or can it be a different user?


----------



## balanga (Mar 9, 2017)

I've found that the supplied wp-config.php contains a lot of 'wpe_' entries such as wpe_all_domains and wpe_netdma_domains which the original site addresses hard coded. I have no real idea what all this does, although I think it refers to WP_Engine, which I think I should try to remove, although I don't know if everything will work without it...


----------

