I am using ffmpeg to convert video, this is a sample script:
$str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/
cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar
22050 -y /home/transla1/public_html/cybertube/web/uploads/video/
generated/31_70_AK000005.AVI.flv
';
//exec($str);
runExternal($str,$code);
echo $code ;
function runExternal( $cmd, &$code ) {
// echo "command" . $cmd;
$descriptorspec = array(
0 =array("pipe", "r"), // stdin is a pipe that the
child will read from
1 =array("pipe", "w"), // stdout is a pipe that the
child will write to
2 =array("pipe", "w") // stderr is a file to write to
);
$pipes= array();
$process = proc_open($cmd, $descriptorspec, $pipes);
$output= "";
if (!is_resource($process)) return false;
#close child's input
fclose($pipes[0]);
stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);
fclose($pipes[1]);
fclose($pipes[2]);
$code=proc_close($process);
}
It works fine in Command line, when I use "php test.php", it runs
well. But in browser, just gave error 127. I tried to use system() or
exec(), both works in command line only, not in browser.
I can run this script in my local computer under apache, no problem,
but when I put it in shared hosting server, it failed to run in
browser.
I guess the script is not executed or the script just skipped.
I am really in urgent need of this solution. Can anyone give me any
help on how to deal with it?
Thanks in advance 6 5453
xhe schreef:
I am using ffmpeg to convert video, this is a sample script:
$str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/
cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar
22050 -y /home/transla1/public_html/cybertube/web/uploads/video/
generated/31_70_AK000005.AVI.flv
';
//exec($str);
runExternal($str,$code);
echo $code ;
function runExternal( $cmd, &$code ) {
// echo "command" . $cmd;
$descriptorspec = array(
0 =array("pipe", "r"), // stdin is a pipe that the
child will read from
1 =array("pipe", "w"), // stdout is a pipe that the
child will write to
2 =array("pipe", "w") // stderr is a file to write to
);
$pipes= array();
$process = proc_open($cmd, $descriptorspec, $pipes);
$output= "";
if (!is_resource($process)) return false;
#close child's input
fclose($pipes[0]);
stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);
fclose($pipes[1]);
fclose($pipes[2]);
$code=proc_close($process);
}
It works fine in Command line, when I use "php test.php", it runs
well. But in browser, just gave error 127. I tried to use system() or
exec(), both works in command line only, not in browser.
I can run this script in my local computer under apache, no problem,
but when I put it in shared hosting server, it failed to run in
browser.
I guess the script is not executed or the script just skipped.
I am really in urgent need of this solution. Can anyone give me any
help on how to deal with it?
Hi,
Hard to tell, but here a few, not very original, suggestions:
--/home/transla1/bin/ffmpeg actually exists on your ISP? Are the
rights set right for the apache-user too?
--Does your ISP's php.ini maybe prevent you from executing in some
directories, or block exec()/proc_open()/etc?
--Do you have shell access on your ISP? If so, can you run it from the
shell as www-data/apache? (Possibly you need to ask your ISP, since I
don't expect you can sudo su www-data on a shared environment.)
--Make sure you see all errors, notices, etc.
Also, if you haven't tried already, Google: php ffmpeg error 127
It has a few hits that seems to be relevant, but which I didn't read in
detail. ;-)
Regards,
Erwin Moller
>
Thanks in advance
On 16 May, 05:46, xhe <hexuf...@gmail.comwrote:
I am using ffmpeg to convert video, this is a sample script:
<snip>
>
It works fine in Command line, when I use "php test.php", it runs
well. But in browser, just gave error 127. I tried to use system() or
exec(), both works in command line only, not in browser.
999 times out of 1000 this is due to permissions problems - either
your webserver uid can't exec ffmpeg or it can't write the output.
I can run this script in my local computer under apache, no problem,
but when I put it in shared hosting server, it failed to run in
browser.
It highly possible that your shared host webserver is running chroot -
the binary will have a completeky different path if the webserver can
see it at all (more likely it, and its required libs, will be outside
the jail).
I guess the script is not executed or the script just skipped.
I am really in urgent need of this solution. Can anyone give me any
help on how to deal with it?
Write some PHP code to check the executable is where you think it is,
with exec permissions, that the source file is where you think it is
with read permissions and that the destination is where you think it
is with permisions and run from a browser.
C.
Thanks for replying.
1. I wrote script to check the executable, and the file is executable,
readable and writable
2. I run it in cron task, and got the error is
/home/transla1/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory
But the shared object exist. I added the path to include_path into the
php.ini, still wrong.
Now the thing is it can be executed in commandline, but not in script.
So I really got no idea how to solve it
Help will be highly appreciated.
Frank
On May 16, 9:18 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 16 May, 05:46, xhe <hexuf...@gmail.comwrote:
I am using ffmpeg to convert video, this is a sample script:
<snip>
It works fine in Command line, when I use "php test.php", it runs
well. But in browser, just gave error 127. I tried to use system() or
exec(), both works in command line only, not in browser.
999 times out of 1000 this is due to permissions problems - either
your webserver uid can't exec ffmpeg or it can't write the output.
I can run this script in my local computer under apache, no problem,
but when I put it in shared hosting server, it failed to run in
browser.
It highly possible that your shared host webserver is running chroot -
the binary will have a completeky different path if the webserver can
see it at all (more likely it, and its required libs, will be outside
the jail).
I guess the script is not executed or the script just skipped.
I am really in urgent need of this solution. Can anyone give me any
help on how to deal with it?
Write some PHP code to check the executable is where you think it is,
with exec permissions, that the source file is where you think it is
with read permissions and that the destination is where you think it
is with permisions and run from a browser.
C.
xhe wrote:
On May 16, 9:18 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
>On 16 May, 05:46, xhe <hexuf...@gmail.comwrote:
>>I am using ffmpeg to convert video, this is a sample script:
<snip>
>>It works fine in Command line, when I use "php test.php", it runs well. But in browser, just gave error 127. I tried to use system() or exec(), both works in command line only, not in browser.
999 times out of 1000 this is due to permissions problems - either your webserver uid can't exec ffmpeg or it can't write the output.
>>I can run this script in my local computer under apache, no problem, but when I put it in shared hosting server, it failed to run in browser.
It highly possible that your shared host webserver is running chroot - the binary will have a completeky different path if the webserver can see it at all (more likely it, and its required libs, will be outside the jail).
>>I guess the script is not executed or the script just skipped. I am really in urgent need of this solution. Can anyone give me any help on how to deal with it?
Write some PHP code to check the executable is where you think it is, with exec permissions, that the source file is where you think it is with read permissions and that the destination is where you think it is with permisions and run from a browser.
Thanks for replying.
1. I wrote script to check the executable, and the file is executable,
readable and writable
Could you tell us exactly how you checked this? And for which user?
2. I run it in cron task, and got the error is
/home/transla1/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory
But the shared object exist. I added the path to include_path into the
php.ini, still wrong.
php has nothing to do with what happens in executables on system calls.
Adding it to a php.ini path will do nothing, you'll have to tell ffmpeg.
Now the thing is it can be executed in commandline, but not in script.
So I really got no idea how to solve it
Can you run it at the server, logging in by ssh, from the command line?
If so, it's probably still a rights issue of the webserver vs. the ssh
user (vs. the cron user). When in doubt, ask the hoster. If not, and the
only command line it works on is at your home, you might ask the ffmpeg
people how they'd solve the error you got back from ffmpeg by cron job.
--
Rik Wasmus
....spamrun finished
Thanks again for replying.
I found this is the hosting provider issue. I set the environment
variables in .bash_profiles, but those setting can not be recognized
by the web server. and all the self-installed shared object has been
strictly filtered out because
when I use
system('set'),
all those environment setting is not included at all.
So my question now become are there anyway to include
the .bash_profile setting into the web server setting by php?
Thanks
On May 16, 11:24 am, Rik Wasmus <luiheidsgoe...@hotmail.comwrote:
xhe wrote:
On May 16, 9:18 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On 16 May, 05:46, xhe <hexuf...@gmail.comwrote:
>I am using ffmpeg to convert video, this is a sample script:
<snip>
>It works fine in Command line, when I use "php test.php", it runs well. But in browser, just gave error 127. I tried to use system() or exec(), both works in command line only, not in browser.
999 times out of 1000 this is due to permissions problems - either
your webserver uid can't exec ffmpeg or it can't write the output.
>I can run this script in my local computer under apache, no problem, but when I put it in shared hosting server, it failed to run in browser.
It highly possible that your shared host webserver is running chroot -
the binary will have a completeky different path if the webserver can
see it at all (more likely it, and its required libs, will be outside
the jail).
>I guess the script is not executed or the script just skipped. I am really in urgent need of this solution. Can anyone give me any help on how to deal with it?
Write some PHP code to check the executable is where you think it is,
with exec permissions, that the source file is where you think it is
with read permissions and that the destination is where you think it
is with permisions and run from a browser.
Thanks for replying.
1. I wrote script to check the executable, and the file is executable,
readable and writable
Could you tell us exactly how you checked this? And for which user?
2. I run it in cron task, and got the error is
/home/transla1/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory
But the shared object exist. I added the path to include_path into the
php.ini, still wrong.
php has nothing to do with what happens in executables on system calls.
Adding it to a php.ini path will do nothing, you'll have to tell ffmpeg.
Now the thing is it can be executed in commandline, but not in script.
So I really got no idea how to solve it
Can you run it at the server, logging in by ssh, from the command line?
If so, it's probably still a rights issue of the webserver vs. the ssh
user (vs. the cron user). When in doubt, ask the hoster. If not, and the
only command line it works on is at your home, you might ask the ffmpeg
people how they'd solve the error you got back from ffmpeg by cron job.
--
Rik Wasmus
...spamrun finished
On 16 May, 17:28, xhe <hexuf...@gmail.comwrote:
Thanks again for replying.
I found this is the hosting provider issue. I set the environment
variables in .bash_profiles, but those setting can not be recognized
by the web server. and all the self-installed shared object has been
strictly filtered out because
when I use
system('set'),
all those environment setting is not included at all.
So my question now become are there anyway to include
the .bash_profile setting into the web server setting by php?
Thanks
2. I run it in cron task, and got the error is
/home/transla1/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory
Write a shell script to call ffmpeg. You could invoke
your .bash_profile directly but a better solution would be to printenv
and paste the results in the shell script.
(BTW: We're now way OT for PHP)
C. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christian Hammers |
last post by:
Hello
I would like to call a unix shellscript from within a PHP script and
- write data to its STDIN
- read data from its STDOUT *and* STDERR
- get its exit code afterwards
proc_open seems...
|
by: FrenKy |
last post by:
Hi *.
I get this error when trying to run proc_open() function:
"Fatal error: Call to undefined function: proc_open() in
/home/frantic/public_html/a/phpshell.pup on line 140"
Does anybody...
|
by: Muffinman |
last post by:
Howdy,
For a script I need the exact output of the apache htdbm.exe to a var so
I can extract all users from a database. Now I found out that this can
be done with Proc_open. I got this script...
|
by: razorfold |
last post by:
Hi,
I've been trying to run gpg through proc_open() and have failed all
weekend. I keep getting this error from stderr:
"/usr/bin/gpg: error while loading shared libraries: cannot restore...
|
by: razorfold |
last post by:
Hi,
I've written something that takes text and passes it to gpg to encrypt.
It works great except when the text size is greater than 64k at which
point PHP/Apache hangs. Is there any way around...
|
by: Tim::.. |
last post by:
Can someone please tell me why I keep getting the following error for some of
my web application users but not others??? Even though the application runs
from a central webserver???
Thanks for...
|
by: archana |
last post by:
Hi all,
I am having one confusion regarding invoking web method of web service
asychronously through windows applicaiton.
What i am doing is i am having one long runing web method whose one...
|
by: Balamurugan Ranganathan |
last post by:
I want to calculate the execution time of a sql query through C#.net
this is to analysis two queries to compare their execution time
it is very Urgent Please help me
Please help Me
...
|
by: Daniel Klein |
last post by:
Without getting into a lot of unnecessary detail, I'm working on a project
to allow PHP to communicate with a proprietary database.
The IPC mechanism I'm using is 'proc_open'; there is a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |