Windows ffmpeg extension added in php extension issue - php

I am using wamp and 5.5.12 php version
Download php_ffmpeg.dll from somewhere and copied in C:\wamp\bin\php\php5.5.12\ext
restarted wamp and computer as well.
but it says php_ffmpeg.dll is missing any help ?
I am using 64bit system any offical place to look for php_ffmpeg.dll 64bit version
?
the code:
/**
* FFMPEG-PHP Test Script
*
*/
echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
echo "XML: ", extension_loaded('xml') ? 'OK' : 'MISSING', '<br>';
echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';
echo "ffmpeg: ", extension_loaded('ffmpeg') ? 'OK' : 'MISSING', '<br>';
// Check if the ffmpeg-php extension is loaded first
// extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
// Determine the full path for our video
// $vid = realpath('./vid2.avi');
$vid = realpath('input.flv');
// d then display the information about the video clip.
$ffmpegInstance = new ffmpeg_movie($vid);
echo "getDuration: " . $ffmpegInstance->getDuration() . "<br />".
"getFrameCount: " . $ffmpegInstance->getFrameCount() . "<br />".
"getFrameRate: " . $ffmpegInstance->getFrameRate() . "<br />".
"getFilename: " . $ffmpegInstance->getFilename() . "<br />".
"getComment: " . $ffmpegInstance->getComment() . "<br />".
"getTitle: " . $ffmpegInstance->getTitle() . "<br />".
"getAuthor: " . $ffmpegInstance->getAuthor() . "<br />".
"getCopyright: " . $ffmpegInstance->getCopyright() . "<br />".
"hasAudio: " . $ffmpegInstance->hasAudio();

Putting a compiled PHP extension in the extension directory is not sufficient. Additionally, the extension has to be declared in php.ini extension directive, e.g. extension=php_ffmpeg.dll.
I am using 64bit system any offical place to look for php_ffmpeg.dll 64bit version ?
There is http://ffmpeg-php.sourceforge.net/, but this project is abandoned, so you're probably out of luck. See https://trac.ffmpeg.org/wiki/PHP for alternative ways to use ffmepg from PHP.

Related

IP and port is open still PHP is not connecting?

I am trying to connect to MikroTik RouterOS through External Remote IP but I am not able to connect as I can see that I can successfully connect to API through Localhost but can't connect through my hosted file at my site..!
Here is link to file :
http://huntedhunter.com/router-api/examples/example1.php
Besides strange thing is that 8728 port is open on my IP and still it's not connecting...!
I am using this API to connect :
https://github.com/BenMenking/routeros-api
<pre>
<?php
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('39.33.4.164', 'test', 'test')) {
$ARRAY = $API->comm("/system/resource/print");
$first = $ARRAY['0'];
$memperc = ($first['free-memory']/$first['total-memory']);
$hddperc = ($first['free-hdd-space']/$first['total-hdd-space']);
$mem = ($memperc*100);
$hdd = ($hddperc*100);
echo "Mikrotik RouterOs 4.16 Resources";
echo "<br />";
echo "<table width=550 border=0 align=center>";
echo "<tr><td>Platform, board name and Ros version is:</td><td>" . $first['platform'] . " - " . $first['board-name'] . " - " . $first['version'] . " - " . $first['architecture-name'] . "</td></tr><br />";
echo "<tr><td>Cpu and available cores:</td><td>" . $first['cpu'] . " at " . $first['cpu-frequency'] . " Mhz with " . $first['cpu-count'] . " core(s) " . "</td></tr><br />";
echo "<tr><td>Uptime is:</td><td>" . $first['uptime'] . " (hh/mm/ss)" . "</td></tr><br />";
echo "<tr><td>Cpu Load is:</td><td>" . $first['cpu-load'] . " %" . "</td></tr><br />";
echo "<tr><td>Total,free memory and memory % is:</td><td>" . $first['total-memory'] . "Kb - " . $first['free-memory'] . "Kb - " . number_format($mem,3) . "% </td></tr><br />";
echo "<tr><td>Total,free disk and disk % is:</td><td>" . $first['total-hdd-space'] . "Kb - " . $first['free-hdd-space'] . "Kb - " . number_format($hdd,3) . "% </td></tr><br />";
echo "<tr><td>Sectors (write,since reboot,bad blocks):</td><td>" . $first['write-sect-total'] . " - " . $first['write-sect-since-reboot'] . " - " . $first['bad-blocks'] . "% </td></tr><br />";
echo "</table>";
echo "<br />";
echo "<br />";
echo "<br />";
echo "<br />Debug:";
echo "<br />";
$API->disconnect();
}
?>
</pre>
First check if api service is enabled in routeros
[admin#mikrotik] > /ip service print
Flags: X - disabled, I - invalid
# NAME PORT ADDRESS CERTIFICATE
0 XI telnet 23
1 XI ftp 21
2 XI www 8989
3 ssh 22
4 XI www-ssl 443 none
5 XI api 8728
6 winbox 8291
7 XI api-ssl 8729 none
XI flag near service name - the service is desabled
Second check your firewall filter table. Chain "input"
You need allow input access to api service port. Api service port you can check at first point in this answer

where is this wrong in ffmpeg installation and php configuration

hello all i have successfully installed ffmpeg to my computer i can check it by checking ffmpeg-version it returns something logical.
which means the ffmpeg is running successfully on my pac but when i run this code by php i get error in ffmpeg loading
<?php
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
// Determine the full path for our video
$vid = realpath('./test/Sample.mp4');
// Create the ffmpeg instance and then display the information about the video clip.
$ffmpegInstance = new ffmpeg_movie($vid);
echo "getDuration: " . $ffmpegInstance->getDuration() . "<br />".
"getFrameCount: " . $ffmpegInstance->getFrameCount() . "<br />".
"getFrameRate: " . $ffmpegInstance->getFrameRate() . "<br />".
"getFilename: " . $ffmpegInstance->getFilename() . "<br />".
"getComment: " . $ffmpegInstance->getComment() . "<br />".
"getTitle: " . $ffmpegInstance->getTitle() . "<br />".
"getAuthor: " . $ffmpegInstance->getAuthor() . "<br />".
"getCopyright: " . $ffmpegInstance->getCopyright() . "<br />".
"getArtist: " . $ffmpegInstance->getArtist() . "<br />".
"getGenre: " . $ffmpegInstance->getGenre() . "<br />".
"getTrackNumber: " . $ffmpegInstance->getTrackNumber() . "<br />".
"getYear: " . $ffmpegInstance->getYear() . "<br />".
"getFrameHeight: " . $ffmpegInstance->getFrameHeight() . "<br />".
"getAudioChannels: " . $ffmpegInstance->getAudioChannels() . "<br />".
"hasAudio: " . $ffmpegInstance->hasAudio();
?>
please tell me where i am doing wrong
looks like ffmpeg-php module is not installed

Cannot upload using php scripts

I have a script in php that is used to upload files to a server. It was working first but i dont know why its not working again. It shows no error but the file is not still uploaded to the directory that i assigned to hold all uploaded files. Here is the part that takes care of the upload:
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Uploaded: " . basename($_FILES["file"]["name"]) . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//by default the size of the file is in bytes so u need to divide by 1024 in order to bring it to KB
echo "Temporarily stored in: " . $_FILES["file"]["tmp_name"] . "<br />";
$target="/file/" . basename($_FILES["file"]["name"]) . "<br />";
}
if(move_uploaded_file($_FILES["file"]["tmp_name"], $target))
{
echo "<h2>" . "The file has been stored on the server" . "<br />" . "<h2 />";
echo "New storage location is : " . '<a href="/public/files/" >' . $target . '</a>';
?>
<html>
<body>
<div align="right"><a href="/public/files/" >Uploaded files</a></div>
<br />
</body>
</html>
<?php
}
else
{
echo "<h2>" . "Error while saving the file to the server." . "<br />" . "File wont be found in the uploaded files directory" . "<br />" . "<h2 />";
echo "The error says: " . $_FILE["file"]["error"] . " What do we do now?" ;
echo"<pre>".print_r($_FILES,true)."</pre>";
?>
<?
/file/ is a directory in the root of your server's filesystem, which almost certainly doesn't exist. move_uploaded_file() works at the filesystem level and has absolutely NO awareness of your site's URI structure. You probably want something more like:
move_uploaded_file(...,. $_SERVER['DOCUMENT_ROOT'] . '/file/');
^^^^^^^^^^^^^^^^^^^^^^^^^^^---- add this
so that the file gets moved to a /file subdir of your site's root directory.

file uploading in php

Here my code
echo "Upload: " . $_FILES["audio"]["name"] . "<br/>";
echo "Type: " . $_FILES["audio"]["type"] . "<br/>";
echo "Size: " . ($_FILES["audio"]["size"] / 1024) . " kB<br/>";
echo "Temp file: " . $_FILES["audio"]["tmp_name"] . "<br/>";
move_uploaded_file($_FILES["audio"]["tmp_name"],
"/var/www/html/mnworld/upload/audiofile/" . $_FILES["audio"]["name"]);
echo "Stored in: " . "/var/www/html/mnworld/upload/audiofile/" . $_FILES["audio"]["name"];
I tried to upload file in this (/var/www/html/mnworld/upload/audiofile/) directory but its always empty its not showing any errors. I need to upload this directory
Check the permission of the folder where the files are to be stored is in 777 mode (both Read and write). If not, change the mode to chmod 777. And also make sure that the path to be stored should be correct.
Since you have the correct details. The problem is only the permission of the folder that unables you to move/copy the file.
Use this: chmod 777 /var/www/html/mnworld/upload/audiofile/

Can't find uploaded files after PHP image upload

I'm uploading files from an iPhone app to PHP using the following code:
<?php
if ($_FILES["media"]["error"] > 0) {
echo "Error: " . $_FILES["media"]["error"] . "<br />";
} else {
echo "Upload: " . $_FILES["media"]["name"];
echo "Type: " . $_FILES["media"]["type"];
echo "Size: " . ($_FILES["media"]["size"] / 1024);
echo "Stored in: " . $_FILES["media"]["tmp_name"];
if (file_exists("uploads/" . $_FILES["media"]["name"])) {
echo $_FILES["media"]["name"] . " already exists. ";
} else {
move_uploaded_file($_FILES["media"]["tmp_name"],
"uploads/" . $_FILES["media"]["name"]);
echo "Stored in: " . "uploads/" . $_FILES["media"]["name"];
}
}
?>
Afterwards, I get the success message saying "uploads/2542543.jpg" - but I can't seem to find where the image is actually stored. Is the filepath relative to the php file (which is in php - and has an uploads folder) or is it absolute from the root??
EDIT: Looks like the file should have ended up in php/uploads/filename.jpg - but it doesn't appear to be making it. I don't quite understand why - anyone have any idea?
This is an absolute path from the root
/uploads/2543.jpg
This is a relative path from your PHP document
uploads/2543.jpg
So you're working with a relative path (note the missing / at the start)
This is defined in php.ini using the upload_tmp_dir directive. If that's not set, it uses the system default, which you can figure out using sys_get_temp_dir. I believe it defaults to /tmp on Linux, and C:\Windows\Temp\ on Windows.

Categories