Doc #65012 [Opn->Fbk]: exec command not working from browser
| From: | ab@php.net | Date: | Tue, 11 Jun 2013 12:47:33 +0000 |
| Subject: | Doc #65012 [Opn->Fbk]: exec command not working from browser | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9913@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65012&edit=1
ID: 65012
Updated by: ab@php.net
Reported by: pganesan at corenttech dot com
Summary: exec command not working from browser
-Status: Open
+Status: Feedback
Type: Documentation Problem
Package: Apache related
Operating System: WAMP
PHP Version: 5.3.26
Block user comment: N
Private report: N
New Comment:
Basically it works like this
exec('c:\\windows\\system32\cmd.exe /C "c:\\my\\commando.exe --arg"');
All the backslashes have to be escaped. Also you'll need to use escapeshellarg()
if you pass something dynamically or if there are spaces in the path. Also it's
better to put the suffix as well, like command.exe .
Previous Comments:
------------------------------------------------------------------------
[2013-06-11 11:47:31] pganesan at corenttech dot com
Description:
------------
trying to database dump using following Query using exec command,
exec('pg_dump -U postgres -h localhost -p 5432 recipedb1 >
C:\TEMP\dumpfilename1.sql');
exec('C:\Program Files\PostgreSQL\9.0\bin\pg_dump -U postgres -h localhost -p 5432 recipedb1
> C:\TEMP\dumpfilename1.sql');
But Its working fine from running in terminal(cli mode),
Please check
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65012&edit=1