Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/09/2006, 06:54
Cluster
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
mm En principio PHP impone restricciones a los ejecutables que se pueden "ejecutar" (valga la rebundancia) y en que rutas. Esto lo hace cuando usas "safe mode" (que creo que no es tu caso):

http://www.php.net/manual/en/features.safe-mode.php

Sobre todo la directiva: safe_mode_exec_dir es la que indica en que rutas puedes ejecutar archivos .. normalmente se indica "./" (el directorio en que estás) y tal vez otras rutas concretas o una sóla definida donde estableces permisos y tienes el control.

Por otro lado en php.net hay algunos comentarios de interes:

Cita:
rymfaxe (at) hotmail (dot) com
04-Dec-2005 01:50
Starting batch or exe files (from a local Apache server 1.3.24 with PHP 4.3.1) to be executed within WinXP SP2 and having the program running in background - which certainly is tricky.

I figured this peace of code makes it very possible.
Instead of using exec() I prefered popen() adding the parameter /b which makes it run in the background, thus having PHP script continued to be interpreted contrary to be hanging in the process.

Código PHP:
<?php
function callTool ($path,$file) {
   
chdir($path); $call $path.$file;
   
pclose(popen('start /b '.$call.'''r')); 
}

// -- Call tool1 -----
$location "c:\path\to\desired\folder"
$filename "\tool1.exe";
callTool($location,$filename);

// -- Call tool2 -----
$location "c:\path\to\desired\folder"
$filename "\tool2.bat";
callTool($location,$filename);

// -- Call tool3 -----
$location "c:\path\to\desired\folder"
$filename "\tool3.com";
callTool($location,$filename);
?>
This example assumes that the Apache properties locally has bin told to 'allowe this server to interact with desktop' which on WinXP is to be set under Start > Run > services.msc - next, right click "Apache...", select properties and click on the 'login tab'.

Hope someone to benefit out of this stuff.
Otro más:
Cita:
Shaun
26-Jan-2005 06:53
Trying to use 'exec' to run a helper executable on Win2K3 (and I'm told this also happens on Win2K) from a PHP script running on IIS, failed to invoke the executable.

Running the same PHP script on Win2K using Apache to serve the page calling the same helper executable worked.

Solution: On Win2K3 (and probably Win2K), give the IIS IUSR_xxxxx guest user Read & Execute permissions to Cmd.exe found in the System32 folder under Windows root directory.

This one had me confused longer than it should have! Hope this saves others from the same fate!
Te recomiendo ver más comentarios (de los usuarios) al respecto en:
http://www.php.net/manual/en/ref.exec.php

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.