execution de conversion

Eléphant du PHP | 119 Messages

05 févr. 2011, 23:26

bonjour,

l'exécution de la conversion d'upload ne ce fait pas, je suis obligé d'appeler le script manuellement ...
//============================START OF FFMPEG ACTIONS ==================================
// sending command to convertor.php tp convert the movie named : uploaded_file_name ..
// conversion happens in background so user is not delayed browser window can even be closed.

$base_path = installation_paths();
$convertor = $base_path . '/convertor.php';

//check if we are debugging so the convertor is called as url
if ($debugmodex == 1){ //yes debug mode
	header("Location: " . "convertor.php?id=$uploaded_file_name&debug=1");
	die;
}

//else load convertor in background
exec("$path_to_php $convertor $uploaded_file_name> /dev/null &");// (>/dev/null & part is what sends to background)

//=================================== START OF TBS DISPLAY ====================================

/////////////////////////////////////////
// V3 video response done via thickbox
// don't fire up main_1 or site complete

if ( $vid_response == 'vid_response' ) {
	$template = "themes/$user_theme/templates/response_upload_complete.htm";
} else {
	$template = "themes/$user_theme/templates/main_1.htm";
	$inner_template1 = "themes/$user_theme/templates/inner_upload_complete.htm";
}

$covertor_url = $config["site_base_url"].'/convertor.php';
@exec("curl -G $covertor_url > /dev/null &");// (required where background process does not work)

$TBS = new clsTinyButStrong;
$TBS->NoErr = true;
$TBS->LoadTemplate("$template");
$TBS->Render = TBS_OUTPUT;
$TBS->Show();


@exec("$path_to_php $convertor $uploaded_file_name> /dev/null &");// (>/dev/null & part is what sends to background)

@mysql_close();

die();
en fin d'upload le script convertor.php doit se lancer et effectuer la conversion automatiquement, mais ca ne marche pas, sauf si je l'envoie manuellement via http://monsite/convertor.php

une idée ?

ViPHP
xTG
ViPHP | 7331 Messages

05 févr. 2011, 23:53

Et en enlevant le @ cela donne quoi d'affiché ?

Eléphant du PHP | 119 Messages

06 févr. 2011, 00:10

j'ai retiré les 2 @ et j'ai refait un test mais c'est pareil, pas de conversion ...

comme si il ne trouvais pas l'ordre .

ViPHP
xTG
ViPHP | 7331 Messages

06 févr. 2011, 01:09

Renseigne le paramètre $return_var de exec, tu verras si le processus s'est terminé correctement ou non.

Eléphant du PHP | 119 Messages

06 févr. 2011, 01:26

je ne pige pas :oops:

ViPHP
xTG
ViPHP | 7331 Messages

06 févr. 2011, 11:48

string exec ( string $command [, array &$output [, int &$return_var ]] )
Si l'argument return_var est présent en plus du tableau output, alors le statut de retour d'exécution sera inscrit dans cette variable.

Eléphant du PHP | 119 Messages

06 févr. 2011, 18:49

j'ai fait un fichier test comme ceci pour voir si la conversion s'exécutait mais non ...
<?php
require 'classes/config.php';
error_reporting(-1);
ini_set('display_errors', 1);

$base_path = installation_paths();
$convertor = $base_path . '/convertor.php';

$covertor_url = $config["site_base_url"].'/convertor.php';
$cmd = "curl -G $covertor_url > /dev/null &";

exec($cmd);
?>

ViPHP
xTG
ViPHP | 7331 Messages

06 févr. 2011, 19:34

Et que donne ceci :
<?php
require 'classes/config.php';
error_reporting(-1);
ini_set('display_errors', 1);

$base_path = installation_paths();
$convertor = $base_path . '/convertor.php';

$covertor_url = $config["site_base_url"].'/convertor.php';
$cmd = "curl -G $covertor_url > /dev/null &";

exec($cmd, NULL, $retour);
echo "retour : $retour";
?>

Eléphant du PHP | 119 Messages

06 févr. 2011, 19:55

j'ai une erreur : Fatal error: Only variables can be passed by reference in /home/www/nexx.php on line 12


12 . exec($cmd, NULL, $retour);
<?php
require 'classes/config.php';
error_reporting(-1);
ini_set('display_errors', 1);

$base_path = installation_paths();
$convertor = $base_path . '/convertor.php';

$covertor_url = $config["site_base_url"].'/convertor.php';
$cmd = "curl -G $covertor_url > /dev/null &";

exec($cmd, NULL, $retour);
echo "retour : $retour";
?>

ViPHP
xTG
ViPHP | 7331 Messages

07 févr. 2011, 03:04

Zut ça m'apprendra à recommander la documentation et à pas la lire...
<?php
require 'classes/config.php';
error_reporting(-1);
ini_set('display_errors', 1);

$base_path = installation_paths();
$convertor = $base_path . '/convertor.php';

$covertor_url = $config["site_base_url"].'/convertor.php';
$cmd = "curl -G $covertor_url > /dev/null &";

exec($cmd, $data, $retour);
echo "retour : $retour";
?>

Eléphant du PHP | 119 Messages

07 févr. 2011, 17:15

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/nexx.php:1) in /home/www/classes/config.php on line 11
retour : 0

pour info : jai testé un truc hier, j'ai placer une tache cron toute les heures avec appel url du convertor.php et ca fonctionne
Modifié en dernier par olivxii le 07 févr. 2011, 17:36, modifié 1 fois.

ViPHP
xTG
ViPHP | 7331 Messages

07 févr. 2011, 17:34

C'est que tu as un affichage avant ton session_start()...
Mais cela n'a rien à voir avec le code présent.
Cela se passe dans le fichier config.php

Eléphant du PHP | 119 Messages

07 févr. 2011, 17:37

en fait j'ai juste ouvert le fichier mais sans avoir fait d'upload.

ViPHP
xTG
ViPHP | 7331 Messages

07 févr. 2011, 17:40

Si ton test via Cron fonctionne cela pourrait être un problème de droits. Enfin ce n'est qu'une supposition. :/

Eléphant du PHP | 119 Messages

07 févr. 2011, 17:48

tu parle des permissions de fichiers ? ou ce que je pensait c'est que apparement le fichier finish_upload.php charge l'ordre a convertor.php mais en affichage de fond, peut etre est ce mon hebergeur qui
n'autorise pas ce genre de fonction mais j'en doute car il est complet.

phpinfo : http://p796.phpnet.org/test.php