• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How to use "Run a PHP script" on the plesk schedule tasks and write php script for that.

questhk09

New Pleskian
Hello,

I'm working on developing a photo sharing application where it has to create a jpg file from the mp4 file that the user uploaded to the database.

The below is the command to create jpg file from mp4 file in the particular directory by using ffmpeg.

# for i in `find /var/www/vhosts/xxxxx.com/httpdocs/save/ -type f -name "*.mp4"`; do ffmpeg -i $i `echo $i | sed -En 's/.conf$/.jpg/p'`; done

Now, my question is that,

I'm trying to set up a ffmpeg cron job on plesk schedule via Tools & Settings > Scheduled Tasks > Add Task.
And I would like to use "Run a PHP script" there that should run the command above every time a mp4 file is uploaded to the database.

I am not really sure how I should use the "Run a PHP script" and how to write the php script to run the above mp4/jpg conver command.

I would appreciate if anyone could show me "an example" of this entire process, specially how to write php script(concise one is enough) with respect to the plesk function "Run a PHP script".


OS:centos-6 (x86_64)
Plesk 17.0.17
ffmpeg version 2.2.2
php-devel
PECL imagick
 
Last edited:
Back
Top