Unexplained Error - Cured with a Tar.gz deployment

I thought I would share some learning after a painful few days of error chasing. It may seem obvious to some, but hopefully will help others.

Problem: A form that should have uploaded files and had been working for several years stopped working after a recent SC update and reported ‘File: (upload failed)’. It worked in development but failed in production.

I worked through a long list of tests (and found a few minor things along the way (e.g. language/charset mis-alignments between SC, PHP and MySQL) but ended up needing input from SC support - who were very helpful and did some inspection and testing of my system as well as exporting the app and testing at the their end (which worked correctly).

Ultimately, the solution was to do a full redeployment using a tar.gz file (I had prevously been using FileZilla FTP set to ‘Overwrite’).

Useful testing /fixing steps I learnt:

  1. Create a simple basic version of the app(s) from scratch and test that.

  2. Create a new temporary installation - on a new server or in a subdirectory e.g. if your main production site is running from foobar/public_html/ create an extra directory and then put a complete deployment in again at foobar/public_html/test_area/. It can then be accessed from www.foobar.com/test_area/ This does mean configuring the production server again but there is no harm in checking that as well. This gives a good fresh start to see if the problem persists.

  3. If the SC production system crashes when you enter the initial password, then check the PHP version is correct. My system defaults to PHP 8.0 but SC currently needs 7.3.

  4. If this resolves the issue (after suitable back ups!!!) then create and deploy the tar.gz file in your main site by copying to the directory and extracting it.
    tar -xf archive_file_name.tar.gz
    If you are completely new to using tar (I was!) then this short guide is very helpful.

  5. If you use Apache, checking that all sub-directories below public_html are 755 and all files are 644 can be achieved by running in terminal (from the public_html directory):
    find . -type d -exec chmod 0755 {} \;
    find . -type f -exec chmod 0644 {} \;