I am trying to install ffmpeg onto my localhost server. I have followed countless blogs and tutorials online form other people who are stuck with this same problem. I follow everything to the letter.
Unzip the file
Copy php_ffmpeg.exe to ext folder in php
copy the rest to system 32
As it says however when I do this I get this error when I start apache.
Fair play but it is in the folder
I also get this error as well:
And Again, here it is:
I have added the extention to my php.ini file
extension=php_ffmpeg.dll
The first time I go this to work I placed the ffmpeg.exe file onto my local host server and ran commands like this:
$cmd = "$ffmpegpath -i $input -an -ss $sec -s $size $output";
shell_exec($cmd);
This works fine on my computer but not on an actual server. Could somebody offer some advice or guidene on where I have one wrong installing the extension or why running the .exe file on a lunix server with shell_exec doesn't work
Yeah ive had problems with the extension version, with windows. I found it is much easier to not use the PHP extension and just call the standard FFMPEG for windows binary with exec() within a simple class, ive added an example script. It will be trivial for you to add a ffmpeg_convert() method to the class.
VideoThumbNailer.example.zip
Edit
Just noticed this statement,
Could somebody offer some advice or guidene on where I have one wrong
installing the extension or why running the .exe file on a lunix
server with shell_exec doesn't work
Linux has its own versions of FFMPEG, you cant mix the two. Your need to install FFMPEG on linux with something like:
sudo apt-get -qqy php5-ffmpeg
And change the path to FFMPEG in your cmd to, leaving out the .exe part:
ffmpeg -i $input -an -ss $sec -s $size $output
Hope it helps
Related
I am trying to execute ffmpeg from php. I have installed ffmpeg locally on my mac via homebrew and I am able to run the commands I need via terminal.
When I try to execute the following code:
<?php
echo "Starting ffmpeg";
$output = shell_exec("ffmpeg -i test.mp3 -codec:a libmp3lame -b:a 128k out.mp3 2>&1");
echo "<pre>$output</pre>";
?>
I am receiving the following on my browser:
Starting ffmpeg
sh: 1: ffmpeg: not found
I am assuming that I somehow need to install ffmpeg to my xampp server but it is not obvious how to do that. After searching online I can find linux and Windows tutorials but I couldn't figure out something out by looking at them.
What I tried doing was to download the ffmpeg static build form https://ffmpeg.org/download.html#build-mac and placed it in the htdocs holder, and then tried to execute ffmpeg as if it was an executable (after changing chmod), but that gave me
sh: 1: ./ffmpeg: Exec format error
How would one go and install and then run ffmpeg on their xampp server?
First check for installation of tha package by "ffmpeg -version"
If it is installed then check for path "whereis ffmpeg", then try your command with full ffmpeg path
I realised that the apache server that xampp starts is a debian instance. I was using the wrong static build (mac instead of debian one). Downloading and using the debian one resolved my issue.
I tried to update my PHP version on my mac but I am facing some issues
When i use cURL it freezes and it will never complete the download on the terminal:
This is the cURL command that I am running is: curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2
I tried to download a package manually but I can't extract it or even know how to install it.
You can use home-brew for installation / https://medium.com/#romaninsh/install-php-7-2-on-macos-high-sierra-with-homebrew-bdc4d1b04ea6 , I find it quite better then managing with Mac OS build in PHP
I don't have enough details so I will go in blind guess here.
First judging by screenshot it is stuck on downloading. For how long it was frozen? Maybe you didn't wait enough.
When you downloading the source what you need to do is:
Assuming you downloaded package with name php-7.2.6.tar.gz from PHP Official website.
Execute command tar xzf php-7.2.6.tar.gz from command line. (assuming you are in the same directory as file). It will unpack it in directory called php-7.2.6.
Enter the directory with command cd php-7.2.6.
Enter in terminal ./configure. It will take a while, so make sure to get some coffee.
After ./configure finished, execute command make. This will take a while as well, so you might get a sandwich.
Once command finished executing the last step will be executing command make install. It will be quicker than others, don't worry. After that you will be able to execute php command.
Optional Run make test to make sure everything is fine.
PHP has been installed, HOORAY!
Hope that helped, have a nice day. And if I answered your question, please mark it 'Answered`.
I have setup the bash feature on my Windows 10, it works well but I can't figure how to use it with PHP, despite a lot of research.
I would like to use a popen like this :
$fp = popen("tail ".$file, "r");
But the error.log says that tail is not recognized as an internal or external command. PHP don't recognize any bash commands but they are working in a shell.
I have try to edit the environnment variables, the PATH but nothing...
I would really appreciate some help, thanks !
You are running PHP from windows. Just because you have Linux Bash installed doesn't mean all the applications that are installed in it are available inside of windows. They are two completely different entities.
If you install php inside of Linux Bash and run the script from Linux it should work.
Another alternative is to install Git for Windows or Cmder or something else like this. They have a windows version of tail, you will just need to make sure it is added to your PATH in windows.
For normal Git for Windows installation you will find it at:
C:\Program Files\Git\usr\bin\tail.exe
I'm using linux and installed xampp that already provided php in its package. Then, I add "export PATH=/opt/lampp/bin:$PATH" to my "~/.bashrc" so that I can use every commands that is provided in xampp directly from my terminal (without needed to pointing to "/opt/lampp/bin"). Everything works fine.
My problem is I'm using netbeans and when I tried to execute my program, it said "/usr/bin/env: php: No such file" I know it happened because there's no php in my "/usr/bin" since I have it via xampp, but I do have it in my "/opt/lampp/bin". How to configure PHP in netbeans so that it's pointing to "/opt/lampp/bin", instead of "/usr/bin"?
I've googled it and they said that I need to install php-cli, which I think is not a good choice since it makes me have two php in my system. IS there any way for me to use netbeans and php from xampp without needed to install php-cli?
I've also tried to Tools->Options->PHP-General and provide PHP interpreter poiting to "/opt/lampp/bin/php" but it didn't work.
Have you e.g. restarted OS after editing .bashrc file? Or run in command line
. ~/.bashrc
to apply changes in bashrc and then start NetBeans and give it another try. Another option could be to use symbolic link
sudo ln -s /opt/lampp/bin/php /usr/bin/php
If you run "which php" does it point to the lampp directory?
I am trying to compile less file using php, and I am trying to use lessc which I installed as nodejs module on my windows 7
I am trying to do :
$command = lessc %s -compress %s
via
exec($command, $output);
and if I do this via cmd it works fine but I can't execute it using above command in php :(.
the path which works are relative to my drive (E:/wamp/my-project/less/hello.less)
Any body knows what I am doing wrong?
Note: I know how I can use lessphp compiler, and I am already using it but I would like to use lessc module installed via nodejs.
Are you able to get the output of the command when it fails? It's possible that lessc isn't directly available in your path. If you installed it via npm install -g then it will likely be in %appdata%, which is a user path'd directory. It really depends upon how the php process gets initiated, but my guess is that this path won't work.
If I need to use an npm module like this, I usually npm install it locally, and invoke the path to lessc.cmd from a relative path to my program.
Hope this helps. Happy coding!