Reply To: the cron does not work

Forums SNAP – WordPress Plugin Forums the cron does not work Reply To: the cron does not work

#559661

I don’t know if this will be of any help to the OP, but I wanted to share my experience regarding cron jobs, WordPress and SNAP Pro as a Mac OS X user.

Due to my lack of experience with creating cron jobs under Mac OS X, I didn’t know how to manually set up a cron event for SNAP Pro, as it is explained on the SNAP Pro support page. So, I purchased a program called LaunchControl which allows me to easily set up launchd events, a.k.a. cron jobs.

At first, the program kept reporting an error 78 whenever I tried to set up the launchd event for WordPress and SNAP Pro. But then I realized what the problem was.

As it turns out, by default, the wp-cron.php file in WordPress does not include a shebang line at the top of the file. I am assuming that this is because WordPress automatically assumes that the PHP interpreter/binary is located in a certain place in the user’s OS.

However, this creates a problem when you are running a third party web server — as I do — and not using the OS-installed version of PHP. As a result, I had to open the wp-cron.php file in my text editor and add the shebang line, pointing it to the PHP binary in my web server setup. Once I did this, the launchd event — meaning wp-cron — and SNAP Pro began working properly.

The only caveat is that each time the developer updates PHP in my web server package, I have to make sure that I recheck the shebang line in wp-cron.php to make sure that it is still pointing to whatever PHP version I happen to be using.

As I said, I don’t know if the above information will help the person who is having a problem, but I thought it might be worth mentioning, just in case.