Jump to content

Recommended Posts

Posted

I'm trying to set up my first cron job using the 'Standard' option in cpanel.

 

I've set up a php script that will delete expired records from a database.

 

In the command field, I've entered this path to the php script I want to run:

/home/mycpanelname/cronjobs/flush_jobs.php

 

As you can see, I've put the php script in a folder called cronjobs outside of my public_html folder.

 

I'm going to adjust the settings so that this script run every night at midnight, but for now I'm having it run every minute for testing purposes.

 

The problem is that when the cron job runs, I get an email with this error:

 

/bin/sh: line 1: /home/mycpanelname/cronjobs/flush_jobs.php: Permission denied

 

Thanks,

Posted

Make sure your php script has execute permissions set and make sure you have this as the very first line of your php script

>#!/usr/local/bin/php

 

Or you can enter the cron entry like this:

>/usr/local/bin/php /home/mycpanelname/cronjobs/flush_jobs.php

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...