I've successfully installed ffmpeg using ssh, as root, on my dedicated server (CentOS 7).
ffmpeg works fine - but now I need to use it without root access.
When i try to use ffmpeg without root access, I get the following error :
ffmpeg: error while loading shared libraries: libx264.so.148:
cannot open shared object file: No such file or directory
The final goal is to be able to use ffmpeg inside my PHP scripts which do not root access.
The easiest solution is to download an already compiled ffmpeg binary/executable and point your script to it. On the FFmpeg Download page refer to the Get the packages section for links to recent static builds for Linux, Windows, and macOS.
You can use shell_exec() as shown in FFmpeg Wiki: PHP and provide the full path to the downloaded binary.
Maybe too late, But here is a updated solution:
Install the lib in your Operating System
https://www.vultr.com/docs/how-to-install-ffmpeg-on-debian-8-or-9
Install for PHP 7.x via composer
https://github.com/PHP-FFMpeg/PHP-FFMpeg
Related
So I have a class that I build that uses the ssh2 package in php. I have successfully set this up and used and tested this class on apache2 server. The server at work where this is going to be running is an instance of litespeed. I have scoured the web for a way to get ssh2 working with this litespeed server however I cannot for the life of me figure it out. I get ssh2_connect() function not found. If I go go /etc/php/... I can see that the ssh2.ini file exists. However I believe the active php instance is located /usr/local/lsws/lsphp74/7.4/etc/php/ where I do not see the ss2.ini located. Is there a way to get ssh2 installed in the directory that is being used by the server? If I run ssh2_connect at the command prompt, it works just fine as it is most likely using the /etc/php instance of php.
You're correct, ssh2_connect() is provided by a pecl extension. These are optional binary add-ons for php. I'd make a quick phpinfo(); page and add it to the litespeed server so you can see what modules are active and where the config files php is using are actually located on disk.
The install guide can walk you through installing this pecl extension.
https://www.php.net/manual/en/ssh2.requirements.php
Another way to accomplish this is with a pure-php library that doesn't depend on special plug-ins. phpseclib fully implements the ssh protocol in pure php, taking advantage of libraries if they are present but it's able to function without them.
since you didn't mention what exactly is your server env
I would assume it's either OpenLiteSpeed image , or CyberPanel image
first of all , compile libssh2
wget https://libssh2.org/download/libssh2-1.10.0.tar.gz
tar vxzf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
then compile the PHP extension
mkdir /usr/local/lsws/lsphp74/tmp
pecl channel-update pecl.php.net
/usr/local/lsws/lsphp74/bin/pear config-set temp_dir "/usr/local/lsws/lsphp74/tmp"
/usr/local/lsws/lsphp74/bin/pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz
echo "extension=ssh2.so" > /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/50-ssh2.ini
and finally , restart lsphp process to load new module
touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt
or
killall lsphp
then verify by phpinfo(); to make sure you see ssh2 loaded
When trying to use gRPC from Windows with PHP, I could find Windows binaries for "protoc.exe" and "php_grpc.dll" but I have not been able to find any "grpc_php_plugin" (exe or dll?) and thus have not succeeded to use gRPC from Windows/PHP.
Documentation page:
https://grpc.io/docs/quickstart/php/
The current documentation at the above paqe is unix-oriented (with "make grpc_php_plugin" and "bins/opt" paths in flags such as --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin).
However, it kind of seems as Windows should be supported since the page does mention "Install on Windows You can download the pre-compiled grpc.dll extension from the PECL website."
On the other hand, if only two of the three needed binaries are available, then it is not enough, since as far as I understand, the following three binaries are needed:
"protoc.exe" (indeed available in "protoc-3.11.4-win64.zip" )
"php_grpc.dll" (indeed is available in "php_grpc-1.28.0-7.4-nts-vc15-x64.zip" )
(and I am using 64 bit Windows 10 with nts/non-thread-safe PHP 7.4.4)
"grpc_php_plugin" (exe or dll?) NOT (?) available for Windows?
When trying to use the example at the quickstart page, you find this example command:
protoc --proto_path=examples/protos --php_out=examples/php --grpc_out=examples/php --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin ./examples/protos/helloworld.proto
The problem is the plugin flag "--plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin".
When using Windows, you have not compiled with "make grpc_php_plugin" but need to download a binary for Windows and put it in a Windows path instead of the "bins/opt/grpc_php_plugin".
So, if anyone has actually been able to use gRPC for PHP with Windows 10, then please explain to make it work regarding the "grpc_php_plugin" which seems to be needed but not available.
Here is grpc_php_plugin.exe and some others: https://github.com/aaapi-net/protoc-windows-gen-plugins
Just download it and use the following command:
protoc -I proto/ --php_out=proto --grpc_out=proto
--plugin=protoc-gen-grpc=./grpc_php_plugin.exe example.proto
Install plugins from more reliable source than git above
Download and install http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20200602.exe
Open installed Msys2
Update packages: pacman -Su
Install grpc-plugins: pacman -S mingw-w64-x86_64-grpc
Your plugins are here: C:\msys64\mingw64\bin
or
You can just download http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-grpc-1.29.1-1-any.pkg.tar.zst
Open it with zstd plugin http://facebook.github.io/zstd/
My Windows 7 PC for some reason will not load the PHP cURL module regardless of which WAMP server software package I install. This isn't a huge issue most of the time as most libraries will use an alternative function.
My question is about this message I get in my terminal window when I run composer commands on packages that try to use curl....
PHP Warning: PHP Startup: Unable to load dynamic library 'G:\php\ext\libcurl.dll' - %1 is not a valid Win32 application.
Notice above in the error I get from composer it is referencing my G drive G:\php\ext\libcurl.dll. My current dev server and active PHP is located in my E drive here E:\Dev_Server\php
I checked my Windows PATH property to make sure a reference to the old G drive PHP wasn't stuck in there somewhere and it is not. My new E drive is in my path. So I am wondering where Composer is storing the G drive PHP reference so I can update that, any ideas?
PHP CLI (which Composer uses) and PHP WAMP (which, well, WAMP uses) use different configuration files. Composer by itself does not store anything about your PHP installation.
What to do: Run php --ini and php -i | more from command line (cmd.exe). Check which configuration files PHP CLI uses and check what is configured there. You probably will find references to your G: drive there.
I wonder how I can install PhP 5.4.4 on either ubuntu 10.04.4 or parallels plesk panel 11.
I just ordered a VPS running ubuntu with plesk panel, but the problem is that my plesk use php 5.3 and I need php 5.4.4 .
I have tried a few guides but I cant get it to work : /
Anyone here who has a good guide on how to do this?
So go to the php download page and find the tar.gz version of the file you want. Clicking on it should give you a list of mirrors ill use wget http://us2.php.net/get/php-5.4.17.tar.gz/from/us1.php.net/mirror as the mirror for 5.4.17. Copy the url for the mirror you want to use. Then ssh into the server and:
wget http://us2.php.net/get/php-5.4.17.tar.gz/from/us1.php.net/mirror
This will download the file php-5.4.17.tar.gz to the working directory on the server.
Unpack the file:
tar -xvzf php-5.4.17.tar.gz
No you will have the directory structure mentioned in the installation instructions you linked to so you can just follow them from there (step 3).
I have RabbitMQ running on one of our servers and am trying to connect to it via PHP. I am developing on a Windows7 machine and my first line of code reads:
$cnn = new AMQPConnection();
It gives me the error:
Fatal error: Class 'AMQPConnection' not found in
I know that it is something that I need to install but what is it ? I am new to PHP so a little help would be nice.
Ps: I can connect to the RMQ server via the RabbitMQ admin web interface.
Thank you
Jack
Installation guide for php_amqp 1.4.0 (Stable version):
Download proper package for your php version from https://pecl.php.net/package/amqp/1.4.0/windows
Unpack php_amqp.dll to X:/php/ext/ directory
Unpack rabbitmq.1.dll to X:/Windows/system (not system32) directory
Modify php.ini file and add "extension=php_amqp.dll" line at the end of extensions list
Verify module installation by executing command "X:/php/php.exe -m" in command line
Restart webserver
I am developing on a Windows7 machine
You may be out of luck using that specific code. That class is from the PECL aqmp extension. Inside the installation instructions, it states:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
You will want to use another library to speak to your message queue instead.
The rabbitmq-c library supports windows now, and the php_amqp pecl extension builds on windows as well. The documentation just hasn't been updated, nor are there any official binary builds in the wild. However, I managed to get them to build and have some 32 bit dll's available for download here:
http://www.nathanjohnson.info/?p=77
# AMQP installation php.net:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
But here at RabbitMQ website is a windows installer...
Apparently this php.net page is outdated
To install do like this:
Download the correct package for your php from this official PECL amqp 1.4.0 page
unzip
add amqp.dll to your php ext folder
add rabbitmq.1.dll to your windows system 32 folder.
This according to the post on the blog I found here i think it is from the same #NathanJohnson who posted also here.
How I got it working:
My System Config: Win 7 Pro, (x64) XAMPP running PHP 5.6(x86)
Follow instruction from here to install RabbitMQ:
https://www.rabbitmq.com/install-windows.html
Now download compatible extension from here
https://pecl.php.net/package/amqp/1.4.0/windows
in my case it is "5.6 Thread Safe (TS) x86"
Now from zip file (php_amqp-1.4.0-5.6-ts-vc11-x86.zip) downloaded copy dll "php_amqp.dll" to your php extension folder in my case it is "xampp/php/ext" and copy dll "rabbitmq.1.dll" to "Windows\system" directory.
now register your php_amqp dll in php.ini file as
"extension=php_amqp.dll"
now restart apache.
Done. Now you should not get AMQPConnection not found exception.