Forum Moderators: coopster

Message Too Old, No Replies

exec is not working right please help

         

MrGecko

9:41 pm on Jun 4, 2007 (gmt 0)

10+ Year Member



I'm trying to convert a video with exec i have just installed php 5.0.5 on my server and every thing seems to work except exec can you help
i have tried
<?
runExternal( "ffmpeg -i video.mov -s 320x240 -r 30 video.flv", &$code );
if( $code ) echo "bad transcoding";
else echo "looks good";

function runExternal( $cmd, &$code ) {

$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 imidiately
fclose($pipes[0]);

stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);

$todo= array($pipes[1],$pipes[2]);

while( true ) {
$read= array();
if(!feof($pipes[1]) ) $read[]= $pipes[1];
if(!feof($pipes[2]) ) $read[]= $pipes[2];

if (!$read) break;

$ready= stream_select($read, $write=NULL, $ex= NULL, 2);

if ($ready === false) {
break; #should never happen - something died
}

foreach ($read as $r) {
$s= fread($r,1024);
$output.= $s;
}
}

fclose($pipes[1]);
fclose($pipes[2]);

$code= proc_close($process);

return $output;
}
?>


and
<?
exec("ffmpeg -i video.mov -s 320x240 -r 30 video.flv");
?>

and
<?
system("ffmpeg -i video.mov -s 320x240 -r 30 video.flv");
?>

none worked
each one created the flv file but it is 0 b

i don't know what is wong

[edited by: MrGecko at 9:43 pm (utc) on June 4, 2007]

MrGecko

9:52 pm on Jun 4, 2007 (gmt 0)

10+ Year Member



Here is my php info
phpinfo()
PHP Version => 5.0.5

System => Darwin MrGecko.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh
Build Date => Jun 4 2007 13:43:57
Configure Command => './configure' '--prefix=/Server/php' '--with-xml' '--with-zlib' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-mysql=/usr/local/mysql' '--with-apxs2=/Server/bin/apxs' '--with-config-file-path=/Server/php/conf' '--with-inifile' '--enable-ftp'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /Server/php/conf/php.ini
PHP API => 20031224
PHP Extension => 20041030
Zend Extension => 220040412
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, http, ftp, compress.zlib
Registered Stream Socket Transports => tcp, udp, unix, udg

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

_______________________________________________________________________

Configuration

PHP Core

Directive => Local Value => Master Value
allow_call_time_pass_reference => On => On
allow_url_fopen => On => On
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => /Server/php/conf/append.php => /Server/php/conf/append.php
auto_globals_jit => On => On
auto_prepend_file => /Server/php/conf/prepend.php => /Server/php/conf/prepend.php
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => On => On
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => </font> => </font>
error_log => no value => no value
error_prepend_string => <font color=ff0000> => <font color=ff0000>
error_reporting => 2039 => 2039
expose_php => On => On
extension_dir => ./ => ./
file_uploads => On => On
highlight.bg => #FFFFFF => #FFFFFF
highlight.comment => #FF8000 => #FF8000
highlight.default => #0000BB => #0000BB
highlight.html => #000000 => #000000
highlight.keyword => #007700 => #007700
highlight.string => #DD0000 => #DD0000
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => Off
include_path => .:/Server/php/lib/php => .:/Server/php/lib/php
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => On => On
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.force_extra_parameters => no value => no value
max_execution_time => 0 => 30
max_input_time => 60 => 60
open_basedir => no value => no value
output_buffering => 0 => no value
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 12 => 12
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => sendmail -t -i => sendmail -t -i
serialize_precision => 100 => 100
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 900M => 900M
upload_tmp_dir => no value => no value
user_dir => no value => no value
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.ze1_compatibility_mode => Off => Off

ctype

ctype functions => enabled

dba

DBA support => enabled
Supported handlers => inifile flatfile

dom

DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.5.4
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled

ftp

FTP support => enabled

gd

GD Support => enabled
GD Version => bundled (2.0.28 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
JPG Support => enabled
PNG Support => enabled
WBMP Support => enabled
XBM Support => enabled

libxml

libXML support => active
libXML Version => 2.5.4
libXML streams => enabled

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => 5.0.37
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /tmp/mysql.sock
MYSQL_INCLUDE => -I/usr/local/mysql/include
MYSQL_LIBS => -L/usr/local/mysql/lib -lmysqlclient

Directive => Local Value => Master Value
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => no value => no value
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 6.2 01-Aug-2005

posix

Revision => $Revision: 1.60.2.4 $

session

Session Support => enabled
Registered save handlers => files user sqlite
Registered serializer handlers => php php_binary

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.bug_compat_42 => On => On
session.bug_compat_warn => On => On
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => no value => no value
session.entropy_length => 0 => 0
session.gc_divisor => 100 => 100
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 4 => 4
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.use_cookies => On => On
session.use_only_cookies => Off => Off
session.use_trans_sid => 0 => 0

SimpleXML

Simplexml support => enabled
Revision => $Revision: 1.139.2.4 $
Schema support => enabled

SPL

SPL support => enabled
Interfaces => RecursiveIterator, SeekableIterator
Classes => ArrayIterator, ArrayObject, CachingIterator, CachingRecursiveIterator, DirectoryIterator, FilterIterator, LimitIterator, ParentIterator, RecursiveDirectoryIterator, RecursiveIteratorIterator, SimpleXMLIterator

SQLite

SQLite support => enabled
PECL Module version => 2.0-dev $Id: sqlite.c,v 1.146.2.7 2005/06/07 15:38:37 dmitry Exp $
SQLite Library => 2.8.14
SQLite Encoding => iso8859

Directive => Local Value => Master Value
sqlite.assoc_case => 0 => 0

standard

Regex Library => Bundled library enabled
Dynamic Library Support => enabled
Path to sendmail => sendmail -t -i

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.83 => 90.83
date.sunset_zenith => 90.83 => 90.83
default_socket_timeout => 60 => 60
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=,fieldset= => a=href,area=href,frame=src,input=src,form=,fieldset=
user_agent => no value => no value

tokenizer

Tokenizer Support => enabled

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.5.4

zlib

ZLib Support => enabled
Compiled Version => 1.1.4
Linked Version => 1.1.4

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name

Environment

Variable => Value
TERM_PROGRAM => Apple_Terminal
TERM => xterm-color
SHELL => /bin/sh
TERM_PROGRAM_VERSION => 100.1.8
USER => root
__CF_USER_TEXT_ENCODING => 0x0:0:0
PATH => /bin:/sbin:/usr/bin:/usr/sbin
PWD => /var/root
SHLVL => 1
HOME => /var/root
LOGNAME => root
SECURITYSESSIONID => 210eb0
_ => /Server/php/bin/php

PHP Variables

Variable => Value
_SERVER["TERM_PROGRAM"] => Apple_Terminal
_SERVER["TERM"] => xterm-color
_SERVER["SHELL"] => /bin/sh
_SERVER["TERM_PROGRAM_VERSION"] => 100.1.8
_SERVER["USER"] => root
_SERVER["__CF_USER_TEXT_ENCODING"] => 0x0:0:0
_SERVER["PATH"] => /bin:/sbin:/usr/bin:/usr/sbin
_SERVER["PWD"] => /var/root
_SERVER["SHLVL"] => 1
_SERVER["HOME"] => /var/root
_SERVER["LOGNAME"] => root
_SERVER["SECURITYSESSIONID"] => 210eb0
_SERVER["_"] => /Server/php/bin/php
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["argv"] => Array
(
)

_SERVER["argc"] => 0
_ENV["TERM_PROGRAM"] => Apple_Terminal
_ENV["TERM"] => xterm-color
_ENV["SHELL"] => /bin/sh
_ENV["TERM_PROGRAM_VERSION"] => 100.1.8
_ENV["USER"] => root
_ENV["__CF_USER_TEXT_ENCODING"] => 0x0:0:0
_ENV["PATH"] => /bin:/sbin:/usr/bin:/usr/sbin
_ENV["PWD"] => /var/root
_ENV["SHLVL"] => 1
_ENV["HOME"] => /var/root
_ENV["LOGNAME"] => root
_ENV["SECURITYSESSIONID"] => 210eb0
_ENV["_"] => /Server/php/bin/php

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.