For the last two Runway installs I've had issues getting cron to then run on my server setup (in order to schedule the backups to Amazon S3). I now know the cause, but I'm unsure if its specific to my server hosting setup. I also have a solution, so I have decided to publish the info here for others. If you have the same issue and solved it a different way, I'd love to hear.
On a Runway install, the config.php contains the following code at the top ...
The file config.www-mysite-com.php contains the sitepath, schedule_secret and database settings. The file config.production.php contains nothing except for an opening <?php statement. This all works perfectly when using Runway with http or https because the variable of $_SERVER['SERVER_NAME'] has a value.
When using cron to set up an hourly job, I use a statement like this ...
The cron job runs ok but doesn't do anything. After digging around I see this error ...
'PHP Parse error: syntax error, unexpected end of file in /home/mysite/public_html/perch/config/config.production.php on line 1'
My hosting company tells me that the cause is that the variable of $_SERVER['SERVER_NAME'] doesn't have a value when the PHP statements are run in CLI (Command Line Interface). Therefore the 'switch' statement can't do the necessary file 'include' and it takes the default case and tries to run the code in config.production.php. But that file just contains an opening (but no closing) PHP statement.
I've done two different solutions for this (on the 2 sites where I've encountered it). On one I removed the switch code and just pasted all the Perch statements into config.php as I knew I would not need a secondary set of sitepath and database setings. On the other site I've replicated the contents of config.www-mysite-com.php into config.production.php.
Has anyone else come across this and what's your solution?