Hello,
I've been asked by a client to migrate an OpenCart installation from one SP to another, who has a much more updated and advanced setup compared to the previous SP. I have found this task to be surprisingly difficult for some reason. My plan was to directly copy all the files from the original server and upload them to the new server, then modify all of the appropriate config files to point to the resources they required. I took this route because I could not find an option in the Admin section of OpenCart to properly migrate the installation. The only backup function I found simply downloaded the entire database as opposed to the OpenCart installation.
I realise that the best approach was likely to create a new OpenCart installation and then rebuild from there but such a task would take a much longer time and be much more work. I find it hard to believe that this is the route intended by the developers as well as migrating servers is a very common thing to do.
Anyway, I've managed to migrate the entire installation and with a few bug fixes, the site is functioning as intended (removing custom hardcoded links to get it to do so), however all of the images for the site have vanished. Not even a placeholder image, just a pure and simple broken image. I've checked the images directory and all the appropriate images are in their rightful place. After checking the code, it seems that rather than providing a src for the image, the installation has simply put "src" and then not output the source of the image.
From what I know and my research, this is a problem with the config file and the storage folder, which I have attempted to locate and it does point to the right directory. Also, the permissions are all correct as well. I've also checked the twig files and they are not hardcoded (just in case), so I'm struggling to understand what the problem here is. Does anyone have any ideas? The site functions perfectly currently, it just has no images.
I should also note, I am an experienced web developer who has been contracted to do this work by a client. I'm just hitting a wall when it comes to solving this bug. Everything should be working.
I've been asked by a client to migrate an OpenCart installation from one SP to another, who has a much more updated and advanced setup compared to the previous SP. I have found this task to be surprisingly difficult for some reason. My plan was to directly copy all the files from the original server and upload them to the new server, then modify all of the appropriate config files to point to the resources they required. I took this route because I could not find an option in the Admin section of OpenCart to properly migrate the installation. The only backup function I found simply downloaded the entire database as opposed to the OpenCart installation.
I realise that the best approach was likely to create a new OpenCart installation and then rebuild from there but such a task would take a much longer time and be much more work. I find it hard to believe that this is the route intended by the developers as well as migrating servers is a very common thing to do.
Anyway, I've managed to migrate the entire installation and with a few bug fixes, the site is functioning as intended (removing custom hardcoded links to get it to do so), however all of the images for the site have vanished. Not even a placeholder image, just a pure and simple broken image. I've checked the images directory and all the appropriate images are in their rightful place. After checking the code, it seems that rather than providing a src for the image, the installation has simply put "src" and then not output the source of the image.
From what I know and my research, this is a problem with the config file and the storage folder, which I have attempted to locate and it does point to the right directory. Also, the permissions are all correct as well. I've also checked the twig files and they are not hardcoded (just in case), so I'm struggling to understand what the problem here is. Does anyone have any ideas? The site functions perfectly currently, it just has no images.
I should also note, I am an experienced web developer who has been contracted to do this work by a client. I'm just hitting a wall when it comes to solving this bug. Everything should be working.
Last edited by FIITGuy on Wed Feb 07, 2024 12:44 am, edited 2 times in total.
Hi!
I think this is a problem with folder/file permissions or the wrong owner.
I think this is a problem with folder/file permissions or the wrong owner.
My FREE extensions in marketplace. [ security | flexibility | speedup ]
Moving an website from one hosting to another should not take more than 15-30 minutes if you have a good internet connection.
And because you are an expert, and you don't want to tell what version of opencart was....then 90% is the bug with PHP 8 and images.
https://github.com/opencart/opencart/bl ... e.php#L121
And because you are an expert, and you don't want to tell what version of opencart was....then 90% is the bug with PHP 8 and images.
https://github.com/opencart/opencart/bl ... e.php#L121
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Hello,
Moving a website might take 15-30 minutes but fixing bugs resulting from wildly different server configurations and a heavily modified OpenCart takes longer. Flat websites? Sure.
I'm not here to argue about being an expert, I just wanted to establish that I know what I am doing. I've seen too many threads on here devolve into "Pay us to do it." and wanted to avoid that.
As for the version, it's 3.0.3.8. I posted late and was tired, I forgot to provide it.
I have looked at that bug and when I went into the code, I couldn't find where to make the modification. I'll take another look when I get home.
Moving a website might take 15-30 minutes but fixing bugs resulting from wildly different server configurations and a heavily modified OpenCart takes longer. Flat websites? Sure.
I'm not here to argue about being an expert, I just wanted to establish that I know what I am doing. I've seen too many threads on here devolve into "Pay us to do it." and wanted to avoid that.
As for the version, it's 3.0.3.8. I posted late and was tired, I forgot to provide it.
I have looked at that bug and when I went into the code, I couldn't find where to make the modification. I'll take another look when I get home.
viewtopic.php?f=202&t=221484&p=809111#p809111
If you 3.0.3.8 has the same line, then the problem is elsewhere. You can check if image is loaded when acces in browser direct link to image
If you 3.0.3.8 has the same line, then the problem is elsewhere. You can check if image is loaded when acces in browser direct link to image
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
I know you wrote more and you have most of it working BUT my $0.02 on migrating hosts.FIITGuy wrote: ↑Tue Feb 06, 2024 7:16 amHello,
I've been asked by a client to migrate an OpenCart installation from one SP to another, who has a much more updated and advanced setup compared to the previous SP. I have found this task to be surprisingly difficult for some reason. My plan was to directly copy all the files from the original server and upload them to the new server, then modify all of the appropriate config files to point to the resources they required. I took this route because I could not find an option in the Admin section of OpenCart to properly migrate the installation. The only backup function I found simply downloaded the entire database as opposed to the OpenCart installation.
For me is I don't go to any windows hosting. Just don't like it. I like working in a Unix type of environment.
#1 Check the current and new host environment and make sure you can adjust if needed - phpinfo() is your friend
#2 Tar up everything you can. I personally omit the image directory since mine is so big.
#3 Take a direct export of the database
Move the entire tarball over and let the new host server untar it.
Import the database
Adjust configs, database user/permissions, test.
As xxvirusxx said it should be pretty quick.
As a note I have built and rebuilt my site at least 20 times over the last month. I have even used one of xxvirusxx's versions so I trust his work and suggestions.
Further here is my advice that I also have saw quite a few people give and now agree with.
-Do a from scratch install
(it REALLY IS the best way to go about it ESPECIALLY if you are going from a 1.xxs or 2.xxx version to a 3.xxx. (I wouldn't go to 4 yet))
-Then use the import/export tool to take care of the products and customers.
-Lastly go into the database and focus on the "order" table. Export that, verify/make any changes and import back in.
Put in store info (address, tax structure, zones, etc.)
Enable extensions.
From there you need to look at payment extensions and shipping extensions and do the same as the order table. Export and import making changes as needed.
Next it is a simple look to see what is missing from the orders and customer info. Do the taxes show up? Do the transactions show up? Do the order histories show up? Is there any additional fields that were added, and if so from what, and where are those?
If the owner of the store had others do work, or they themselves installed extensions, you may be all over the database and extensions to try and put everything back to full functionality. Oh and don't forget any VQmods/OCmods. AND ask the store owner if they made any hard coded changes to the codebase.
Seems daunting but it is actually pretty easy.
Mike
cue4cheap not cheap quality
Thank you all for the advice so far.
I've read and taken on board what's been said, the problem is that I tend to work with clients who tend to have cheap/unreliable hosts and heavily modified software. The previous host for this website was running suPHP and lots of other deprecated features in their environment. They have their own control panel as well, which is relatively useless. While a new install is definitely what would've been preferable, a lot of extensions have been put on this OC and development work has been done to get them working by various different companies. To start from scratch would mean losing a lot of functionality the client wants to keep, which is why I chose that particular route.
In my first post, I wasn't trying to one up people, I was simply trying to express my experience working with web development and MVC frameworks, I'm just not familiar with OC 3.0.3.8 and chose the quickest solution - to ask those who might be more familiar.
As for migration, I did try to compress everything into an archive originally, download the archive and then decompress on the new host. The problem is that the web server for the old host, whenever I tried to create an archive, would create an empty archive or corrupt the data. It was my first choice but it didn't work.
After checking the code, unfortunately that bug fix is already there. So the problem is indeed elsewhere. I've also checked the URL of the picture, it loads correctly and exists in the cache. The problem is that it seems like the Controller is passing an empty variable to the View. It's just not generating a src attribute on the img tag itself. This problem occurs on both the banner twig and the product pages, so is it possibly an issue with the controller?
Any further ideas?
I've read and taken on board what's been said, the problem is that I tend to work with clients who tend to have cheap/unreliable hosts and heavily modified software. The previous host for this website was running suPHP and lots of other deprecated features in their environment. They have their own control panel as well, which is relatively useless. While a new install is definitely what would've been preferable, a lot of extensions have been put on this OC and development work has been done to get them working by various different companies. To start from scratch would mean losing a lot of functionality the client wants to keep, which is why I chose that particular route.
In my first post, I wasn't trying to one up people, I was simply trying to express my experience working with web development and MVC frameworks, I'm just not familiar with OC 3.0.3.8 and chose the quickest solution - to ask those who might be more familiar.
As for migration, I did try to compress everything into an archive originally, download the archive and then decompress on the new host. The problem is that the web server for the old host, whenever I tried to create an archive, would create an empty archive or corrupt the data. It was my first choice but it didn't work.
After checking the code, unfortunately that bug fix is already there. So the problem is indeed elsewhere. I've also checked the URL of the picture, it loads correctly and exists in the cache. The problem is that it seems like the Controller is passing an empty variable to the View. It's just not generating a src attribute on the img tag itself. This problem occurs on both the banner twig and the product pages, so is it possibly an issue with the controller?
Any further ideas?
Try to load from non cache folder...
store_url/image/catalog/etc...
And check catalog config file if you have the correct path in
Code: Select all
define('DIR_IMAGE', '/home/blabla/image/');
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Tested loading an image from the non-cached folder, it loads the image via url directly quite happily.
I've also checked the config file, it has everything defined from the right folder.
/home/client/clientwebsite/image/
The only other thing I can think of is that the storage folder is inside the public_html folder rather than outside it. However, it worked fine from within the public_html folder on the old host.
I've also checked the config file, it has everything defined from the right folder.
/home/client/clientwebsite/image/
The only other thing I can think of is that the storage folder is inside the public_html folder rather than outside it. However, it worked fine from within the public_html folder on the old host.
Fixed. The directories were specified using relative paths: "./blahblah/" and changing them to absolute paths has resolved the problem.
I'm not sure why it didn't like relative paths but the main point is the problem is solved. Thank you for your help guys.
I'm not sure why it didn't like relative paths but the main point is the problem is solved. Thank you for your help guys.
GREAT!
Please edit the first post's subject and add [SOLVED]. This way people when doing a search might have the same problem can see how others solved the issue.
Mike
cue4cheap not cheap quality
Who is online
Users browsing this forum: No registered users and 2 guests