• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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