How do I copy installation to new directory before upgrading?


I am about to upgrade from version 2.010, but first want to perform the upgrade from another directory to test it out etc. before I upgrade the main website in the root directory.

I created a /dev directory, and have tried just copying all the current website files (from the root directory) to it, but this doesn’t work. Does anyone know hot to do this properly?

Many thanks


You need to also copy your database.

Then you need to go into the new directory and change the settings in config.local.php to show the new ‘http_path’ and database name. You will also need to edit the new .htaccess file and change RewriteBase to /dev.

That should be all you need to do.

You should also put an entry in the new robots.txt to deny all for the temporary site.

Thanks for this. How would I copy my database? I have already changed the settings in config.local.php, but can’t find the new .htaccess file from my FTP program…

Use phpMyAdmin and copy all the tables from old_db to new_db.

I have tried using phpMyAdmin to export database files, but it is not able to export cscart_sessions, as this file is 34.8MB.

I have also tried backing up the database from the admin of my working (root) website, then copying that file to the /dev website, then logging in to the /dev admin and trying to restore it. Initially the backup hung on the Statistics file, but then I deleted the statistics and it managed to backup ok. The problem now is that when I try to restore, I get the following message :

failed to open stream: No such file or directory in /var/www/…/dev/controllers/admin/database.php on line 129

I have read up that this could be down to permission settings, and have tried to change the permission to 777 on the database.php file itself, admin folder, controllers folder and dev folder, but I don’t think this has worked.

Any ideas please, as this is turning out to be a bit of a nightmare!

So why don’t you clear your statistics and it should clear out your sessions table too.

But sessions should be cleared everytime there’s an update for a new session. It should zap entries older than SESSION_DAYS old.

You could also try something like this in phpMyAdmin

DELETE FROM cscart_sessions WHERE expiry < NOW();
OPTIMIZE TABLE cscart_sessions;

Don’t use 777 unless you’re on a really old style shared system. Use 755 for directories and 644 for files.

After you prune your DB (like above or via other admin functions like clearing statistics), got to the Operations tab in phpMyAdmin. Assuming you have created a new (empty) database via your Cpanel and have given it access permissions that are the same as the old DB (db_user/db_password) then just “Copy” to the new Database name.

I tried the code you gave me, used it in phpMyAdmin, and it executed successfully, but cscart_sessions is still 34.8MB.

I also created a new database in Plesk, went to ‘Add new database user’, typed in the username & password of the old DB, but it tells me that the user already exists… so I can’t seem to set up the same access details.

Ideally I would like to sort out the

failed to open stream: No such file or directory in /var/www/…/dev/controllers/admin/database.php on line 129

problem, as this seems to be by far the easiest way to do this, now and in the future. But I don’t know which directories I have to give which permissions to.

It’s trying to open a file that doesn’t exist. Probably due to your timeout with the sessions table.