OpenCart is a lightweight open-source shopping cart that runs well on standard PHP hosting. This guide shows how to install OpenCart on cPanel manually and lock it down after installation.
Before you start
- A cPanel account, a domain with SSL active, and the OpenCart release ZIP from the official site.
- The release's PHP requirements (OpenCart 4 needs a newer PHP than 3.x).
Prepare PHP
- In cPanel → Software → Select PHP Version, choose a supported version.
- Enable
curl,gd,zip,mbstring,mysqli,zlibandopcache. - Set
memory_limitto 256M andupload_max_filesizeto 16M or more under Options.
Create the database
In cPanel → Databases → Manage My Databases, create a database and a user, and add the user to the database with all privileges.
Upload the files
- Extract the ZIP on your computer. Only the contents of the
uploadfolder are needed. - Upload those contents to
public_html(or your domain's root) with File Manager or SFTP. Uploading a ZIP of them and extracting in File Manager is fastest. - Rename the config files:
config-dist.php→config.phpadmin/config-dist.php→admin/config.php
Run the installer
- Browse to
https://example.com/install/. - Accept the licence. The pre-installation check must show all green; fix anything red in cPanel and refresh.
- Enter the database details: driver MySQLi, hostname
localhost, the full database user and name, and a table prefix (oc_by default). - Create the admin username, password and email.
- Finish, then delete the
installfolder in File Manager.
Secure OpenCart
- Move the storage folder: OpenCart's dashboard shows a notice to move
system/storageoutside the web root. Use the built-in button (OpenCart 4) or move it manually to e.g./home/USER/storage/and updateDIR_STORAGEin both config files. - Rename the admin folder (supported in OpenCart 4 via the dashboard notice); update paths in
admin/config.phpif done by hand. - Protect config files: set
config.phpandadmin/config.phpto 444 or 644 so they are not writable. - Enable SSL: in System → Settings → Server set Use SSL and make sure the config URLs use
https://. - Install only trusted extensions and keep OpenCart updated.
Post-install settings
- SEO URLs: rename
.htaccess.txtto.htaccess, then enable SEO URLs in System → Settings → Server. - Mail: choose SMTP under System → Settings → Mail with a cPanel mailbox.
- Cron: OpenCart 4 has a cron URL under Extensions → Cron Jobs; add it in cPanel → Advanced → Cron Jobs.
Troubleshooting
- Blank page or 500 error: check
error_logand the storagelogsfolder; usually a PHP version mismatch. - Installer says config.php is not writable or missing: rename the
-distfiles and set them to 644 during install. - Images or styles missing after enabling SSL: update
HTTP_SERVERin the config files tohttps://. - Admin login refreshes without logging in: session or cookie domain issues; clear cookies and confirm the URL matches the config.
OpenCart FAQ
Can I install OpenCart with Softaculous?
Yes, if Softaculous offers it on your server; it automates these same steps.
OpenCart 3 or 4?
Choose OpenCart 4 for new shops unless an extension you rely on only supports 3.x.
Is OpenCart suitable for large stores?
It handles small to medium catalogues well; for very large stores consider a VPS and caching.
