Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Last active August 25, 2021 14:06
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save pbrisbin/6794872 to your computer and use it in GitHub Desktop.
Save pbrisbin/6794872 to your computer and use it in GitHub Desktop.
Installing OpenCart on Heroku

Installation

This gets OpenCart running enough that we can use the GUI Installer

  1. Create Heroku project with ClearDB MySQL add-on
  2. Download OpenCart sources
  3. Move ./upload/* to top-level (those are the PHP site files)
  4. Copy zlib.so into ./ext/zlib.so
  5. Write extension = /app/www/ext/zlib.so into php.ini
  6. Push
  7. Open site

Self-installer

Visiting the site opens the installer, make sure the checks are all green and enter the database credentials for your heroku instance.

  1. heroku config | grep DATABASE_URL
  2. The format is mysql://user:password@host/database?params -> input these separately into Installer

This will populate the seed data into mysql and write out appropriate config.php and admin/config.php for connecting to said DB BUT those files are written on a Dyno which may or may not last.

Try to copy them down; if not, follow the next section.

Manual config

  1. View ./install/cli_install.php
  2. Find the sections that write out config.php and admin/config.php
  3. Manually (and annoyingly) create those files yourself
  4. Push

Check heroku logs, you should get a failure for createimagefromjpeg not existing. This is because the default buildpack builds PHP without jpeg support.

PHP + JPEG

  1. heroku config:set BUILDPACK_URL='https://github.com/thoughtbot/heroku-buildpack-php
  2. Push

Site should work now.

Custom Build pack

If for some reason the above build pack is not around, here's more or less how it was created:

  1. Fork heroku/heroku-buildpack-php on GitHub
  2. Run the script from the README on your dyno, with the following differences:
  3. Add --with-jpeg-dir --with-png-dir to PHP ./configure
  4. Replace pushd with cd and popd with cd - (my dyno didn't have pushd/popd)
  5. Copy the compiled sources somewhere
  6. Update bin/compile to reference those sources
  7. Update BUILDPACK_URL to be your repo
@abhiesa-tolexo
Copy link

How to upload OpenCart sources ?
how to move ./upload/*
Please explain

@whatafunc
Copy link

whatafunc commented Aug 12, 2019

How to upload OpenCart sources ?
how to move ./upload/*
Please explain

using heroku CLI
git add -A

git commit -m "improvement"

git push origin master

@Alom310
Copy link

Alom310 commented Aug 21, 2019

where is zlib.so? and where is ./ext?

@whatafunc
Copy link

Copy zlib.so into ./ext/zlib.so
looks like that lib is not avail via that link but it can be compiled or at least downloaded and then copied to the described folder, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment