Re: @EXEC command not work :(

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 May 2010 19:35, loki <loki5100-newsgroup@xxxxxxxx> wrote:
> Hello,
>
> PHP is installed in c:\program files\php
> the PHP script are in network drive \\xxx.xxx.xxx.xxx\scriptdir\
> in the PHP script, we try to launch the command @exec(...) with a executable
> located in c:\program files\ourexecutable\
>
> it's not work :(
>
> but if we move the PHP script from \\xxx.xxx.xxx.xxx\scriptdir\
> to c:\scriptdir\ then it's work !!
>
> everything work good EXCEPT the @EXEC command ...
>
> Safe mode in PHP is OFF ...
>
> Thanks by advance for you help
> stephane
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Can you show the exact exec() call please?

Most likely you are falling foul of the spaces in "Program Files".

Windows needs you to put spaces around any path that has spaces in it.

e.g.

"C:\Program Files\PHP\php.exe"

You can try this at the command prompt!

If you type ...

C:\Program Files\PHP\php.exe -v

you get ...

'C:\program' is not recognized as an internal or external command,
operable program or batch file.

Wrapping it in quotes will show you the PHP version.

There is a gotcha.

In the event that the program name (C:\Program Files\PHP\php.exe)
_AND_ a parameter to the program have spaces in, then you would
normally expect something like this ...

"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Scripts\script.php"

to work.

And it does from the command line.

But not when passed to the shell via the exec() method.

This was fixed in PHP about 2 years ago
(http://svn.php.net/viewvc?view=revision&revision=260429), so if you
are using a newer release of PHP, you can safely ...

exec('"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Scripts\script.php"');

If not, then use ...

exec('""C:\Program Files\PHP\php.exe" -f "C:\Program
Files\Scripts\script.php""');

That is

exec('
"
"C:\Program Files\PHP\php.exe" -f "C:\Program Files\Scripts\script.php"
"
'
);


Richard.
-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux