Jump to content

[SOLVED] PHP can't find external binary, need debugging help


3than

Recommended Posts

I'm working with a drupal installation and the op_video module and am fairly new to PHP.  I installed ffmpeg here: /usr/bin/ffmpeg but the module says it can't find it there.  I suspect it's something to do with the way my server is configured, but I have both safe mode and open_basedir off.  Is there some code I can insert into the module to get a verbose error message that shows what's actually happening when it tries to find ffmpeg?  I want to know where it's actually looking for it, and what happens when it tries to access it.  I think I've quoted the relevant code below.

 

thanks

Ethan

 

	$output = array();
_op_video_ffmpeg_exec('-version', $output, $result);

if($result == 0) {
	$fieldset[] = _op_video_ffmpeg_version_info_fieldset($output);

	$output = array();
	_op_video_ffmpeg_exec('-formats', $output, $result);

	$fieldset[] = _op_video_ffmpeg_formats_fieldset($output);
	$fieldset[] = _op_video_ffmpeg_codecs_fieldset($output);
}
else {
	$fieldset[] = array(
		'#value' => '<p><b>' . t('FFmpeg binary not found.') . '</b></p>'
	);
}

i think i may know what your problem is.

 

run this command for me on your box: cat /etc/ld.so.conf

 

and tell me the output

 

Oh hey, I got quoted in your sig.  :D  And have you seen this problem before? :o  Just curious.

 

Can I see this function's code?

_op_video_ffmpeg_exec()

 

function _op_video_ffmpeg_exec($params, &$output, &$result, $mode = 0) {

$ffmpeg = variable_get('op_video_ffmpeg_binary', OP_VIDEO_DEFAULT_FFMPEG_BINARY);
$extra_params = variable_get('op_video_ffmpeg_extra_params', '');

$command = array($ffmpeg, $params, $extra_params, '2>&1');

_op_video_exec($command, $output, $result, $mode);
_op_video_reset_cron();
}

run:

 

find / -name 'libavdevice.so.*'

 

add the directories that come up with results into that conf file, then run sudo ldconfig

 

no results, just this:

 

find: WARNING: Hard link count is wrong for /proc/vz/vzaquota: this may be a bug in your filesystem driver.  Automatically turning on find's -noleaf option.  Earlier results may have failed to include directories that should have been searched.

OK here's another clue -- I set up a test.php file:

 

<?php
$ffmpeg = "/usr/bin/ffmpeg -version";
$out = @fopen('php://output', 'a') or die("Could not open STDOUT");
exec($ffmpeg);
echo $out;
?>

 

it works fine from the command line, I think:

 

[root@vps httpdocs]# php test.php

FFmpeg version SVN-rUNKNOWN, Copyright © 2000-2007 Fabrice Bellard, et al.

  configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include/ffmpeg --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-libogg --enable-libtheora --enable-libfaad --enable-libfaac --enable-libgsm --enable-xvid --enable-x264 --enable-liba52 --enable-liba52bin --enable-pp --enable-shared --enable-pthreads --enable-gpl --disable-strip

  libavutil version: 49.4.0

  libavcodec version: 51.40.4

  libavformat version: 51.12.1

  built on Jun  4 2007 11:02:12, gcc: 4.1.1 20070105 (Red Hat 4.1.1-52)

ffmpeg      SVN-rUNKNOWN

libavutil  3212288

libavcodec  3352580

libavformat 3345409

Resource id #5

 

but if I hit it via http I get only this:

 

Resource id #3

However, the module still doesn't work, and if I change the test page back to

 

<?php
$ffmpeg = "/usr/bin/ffmpeg -version";
$out = @fopen('php://output', 'a') or die("Could not open STDOUT");
exec($ffmpeg);
echo $out;
?>

 

I still get "Resource id #3" and the same result if I replace ffmpeg with mysql.

 

is there anything wrong with the test page as above?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.