Warning: Trying to access array offset on value of type bool in /var/www/vhosts/tomelliott.com/httpdocs/wp-content/themes/tomelliott/single.php on line 12

Scheduling a custom php script URL with plesk

25 October, 2011 by Tom Elliott

Setting up custom scripts to run automatically has many uses, for example I use scripts for tasks including MySQL database backup and email and managing notifications from website portals. The steps below run through how to set a scheduled task to call a PHP script from your website.

Although I’m running Plesk 9 on a dedicated Windows server, this should apply to other versions of Plesk and server setups:

  1. Once you have you’re PHP file ready and tested, login to Plesk and select ‘scheduled tasks’ from the main screen
  2. Select ‘Add New Task’, making sure ‘switched on’ is selected and give the task a meaningful description. I normally leave the scheduler notification to ‘Do not send’ and program any email notification into the PHP file itself
  3. The ‘Path to executable file’ is where you enter the URL to the php script on your website, but as the direct path to the site on the server. On windows servers for example, this may look something like: C:inetpubvhostsyourwebsite.co.ukhttpdocsfolder1scriptname.phpIf you’re not sure of you’re path, you can run the php command echo $_SERVER['DOCUMENT_ROOT'] from your site to find out.
  4. The arguments field can be left black and task priority set to Normal.
  5. Finally set how frequently you wish the schedule to run. The below example screenshot will run the script at midnight, each Friday every month.

That’s it! Click OK to confirm or Run Now to confirm and test.

Scheduled Task for PHP scripting in Plesk & Linux »

One Comment

  • I have done same like above code.
    But email is not coming.
    Please help me to resolve it.