Applicable to:
- Plesk for Linux
Question
How to install the ffmpeg-php extension in Plesk?
Answer
ffmpeg-php extension can be installed for PHP 5.6 provided by Plesk only. It cannot be installed for PHP 7.x provided by Plesk due to conflicts with Zend.
Follow the next steps to install ffmpeg-php extension for PHP 5.6 provided by Plesk on Plesk Obsidian CentOS 7 (PHP 5.6 is not included into Plesk on other operating systems):
-
Log in to Plesk
-
Install Composer extension from Plesk extension catalog in Extensions:
-
Go to Domains > example.com > File Manager and create a file named
composer.json
with the content below:CONFIG_TEXT: {
"require": {
"php-ffmpeg/php-ffmpeg": "^0.14.0"
}
}Note: The domain example.com is the domain where ffmpeg-php is going to be used
-
Go to Domains > example.com > PHP Settings and select 5.6.40, click OK
-
Go to Domains > example.com > PHP Composer, click Scan to read the composer.json file:
-
Click Install under Package Dependencies:
Note: the
ffmpeg-php
is installed in/var/www/vhosts/example.com/httpdocs/vendor/php-ffmpeg
directory. -
To start using php-ffmpeg add the below to the website code in a PHP page to load the library:
CONFIG_TEXT: require 'vendor/autoload.php';
Additional information
ffmpeg-php extension is not pre-installed in Plesk. If you would like to see ffmpeg-php pre-installed in PHP provided by Plesk, please vote for this feature on Plesk UserVoice.
Comments
23 comments
Hello Alexandr, it’s possible to install it for php 7? cause all my scripts are working now with php 7.
Regards
Carsten
@Carsten Sachse
Unfortunately, it cannot be compiled due to conflicts with Zend, which is included in PHP 7.0 shipped with Plesk:
You may try to add custom PHP version and to install FFmpeg module for it.
ffmpeg is installed but script cant find it here /usr/bin/ffmpeg
@Sohail Khan
Hi!
Please check whether 'ffmpeg_path' is specified in the script and that it is pointing to /usr/bin/ffmpeg.
Check that ffmpeg is in place:
# whereis ffmpeg
ffmpeg: /usr/bin/ffmpeg /usr/include/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz
And check that permissions on /usr/bin/ffmpeg are 755 root:root.
# For a single website, the 'composer' can be used instead. See the command below for the installation and the following link for usage examples: https://github.com/PHP-FFMpeg/PHP-FFMpeg
any guide on how to do this on specific subscription?
Hi Alex,
I follow this : /opt/plesk/php/7.2/bin/php /usr/lib64/plesk-9.0/composer.phar install php-ffmpeg/php-ffmpeg
But get bellow error:
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Invalid argument php-ffmpeg/php-ffmpeg. Use "composer require php-ffmpeg/php-ffmpeg" instead to add packages to your composer.json.
Please help.
Hello @Sharul Hafiz,
PHP extension cannot be installed for a single website, only for the whole PHP
However, as soon as you installed it to some specific PHP version, select this PHP for the domain:
How to change PHP version for a domain in Plesk?
I also removed incorrect information from the article. Thank you for pointing that out!
Hello @VAV
The "composer install" does not require specifying packages (the same info can be found here)
Thus, the correct command will be the next:
However, if you would like to add the mentioned packages to the "composer.json" file, use the next command (the same info can be found here):
Additional information about Composer CLI can be found here:
Composer Documentation | CLI
We install successful with 7.3 php version and work fine. Thanks for Nikita.
We have this error in final: https://www.codepile.net/pile/YxRyXjMn
Hi @Ion Iacob,
One point here: you successfully installed the ffmpeg-php extension for PHP 7.3
OR
The following error appears:
in an attempt to run this command:
?
The ffmpeg-php works, but after executing this # make clean && make && make install it gave the errors that I shared.
The extension is not displayed in Plesk at Tools & Settings> PHP Settings> PHP 7.3
Hi @Ion Iacob,
Reproduced the same errors on my test environment
It happens when steps 6.1, 6.2 and 6.3 were skipped
Please edit the ffmpeg_frame.c file as it suggested in these steps and follow steps 7, 8 and 9 further
If the issue still occurs, please repeat all steps from the beginning one more time in order to make sure that nothing was missed
Hi is there still no solution to this?
I have an application that required ffmpeg and php7.2 or later.
@Mark Tierney
You may install a custom 7.2 PHP version and install ffmpeg-php for it.
Thanks, so far everything seems to be working fine on the normal php 7.2 version.
I followed these instructions:
Then installed the ffmpeg php packages via composer.
I had to add the paths for ffmpeg and ffprobe to the open_basedir path in my php settings and all works fine thanks.
It seems that the application I am using it cannot receive the ffmpeg path when it already has extenson in php5.6. Although it does recognize, it will error is not recognized.
# whereis ffmpeg
ffmpeg: /usr/bin/ffmpeg /usr/include/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz
i use /usr/bin/ffmpeg.I had to switch from cpanel to plesk because it responds too slowly, but ffmpeg seems to be very difficult to install.
Hello,
As mentioned in the article the ffmpeg is not supported currently and all steps are given as a reference. If there some issues with that I suggest you to review the available sources on the possible cause.
In addition you may get in touch with our Professional Service team and discuss possibility of extension installation on paid basis:
https://www.plesk.com/professional-services/
Also I encourage you to share vote for implementing this functionality on our Uservoice portal:
https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/13114461
You are more than welcome to share your opinion in comment section.
Hello,
Please confirm if this is an issue with PHP 8?
If PHP 8, is OK, what are steps to install?
Thanks!
This is really really bad for me, I expect Plesk can run FFmpeg without any issues with my sites running on PHP 7.4, I just purchased a license without checking this. It's really disappointing to know that it can't run FFmpeg for the latest php7.4 or even 8. I just wasted my time installing it and migrating all my websites to my new server with Plesk.
Sadly, 2 of my PHP sites need FFmpeg, now my project will be on pending for a month.
open_basedir: {WEBSPACEROOT}{/}{:}{TMP}{/}:/usr/bin
@Mark Tierney : Can you please guide to install with same way for ubuntu 18.04
Mark Tierney & Deepak Yogi Really struggling with FFMPEG driving me nuts using ubuntu 20.04, step by step guide would be amazing, happy to pay for some help:)
Hi
@Deepak
@Oliver Settle
The instructions in this article are applicable for PHP 5.6 only, so it will not work on Ubuntu servers as PHP 5.6 is not included into Ubuntu repositories. If you find a way to install it on a higher PHP version on Ubuntu servers, feel free to share it here in comments.
Please sign in to leave a comment.