NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to execute external program in php

Anthony aw at sap8.com
Sat Dec 8 11:20:55 EST 2007


On w2k3 getting exec() to work is a PITA.  If you are running fastcgi
you will have to give that user permission to execute cmd.exe.  Since it
will be running as a network service PHP needs to execute both the
program and cmd.exe.  First I would try and figure out who is requesting
the file (who do you have PHP running as) and then give that user access
to cmd.exe.  Also you can use "filemon" to figure that out.

Hope this helps.

-Anthony

Muhammad Rizwan Nawaz wrote:
> Hello,
>
> I have apache 2 , php5 on windows 2003 server. I want to execute the
> external command like,
>
> system( 'c:/PHP/safedir/pdftk.exe
> C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/MLW_Demo_Form_1.pdf 
> dump_data_fields >
> C:/AppServ/www/mylegalwork/images/pdf_files/PROD-5298b6/rizwan')
>
> basicaly pdftk.exe is pdf utility. I have put it in safe directory.
> The problem is when i try to access the page its not execute the
> command. I have try it with passthru, exec and with shell_command but
> all do nothing. Its working fine on my local machine and on linux
> server where i install pdftk but on windows 2003 server its not
> working. I have found an article at
> http://bugs.php.net/bug.php?id=20951 which says there is security
> issue thats why its not allow php to execute the command. If anyone of
> you know anything about it than do let me know. I really want to run
> the command.
>
>
>
> Thanks
> Best Regards,
> Muhammad Rizwan Nawaz
> Email / MSN Messenger: rizwan_nawaz786 at hotmail.com
> <mailto:rizwan_nawaz786 at hotmail.comGmail>
> Gmail: rizwannawaz at gmail.com <mailto:rizwannawaz at gmail.com> 
> Yahoo IM: rizwan051
> AOL IM: riznawaz
> Skype: rizwannawaz
> ICQ: 442047681 
>
> =============
> SECURITY NOTICE
> =============
>     
> THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
> CONFIDENTIAL.  IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
> NAMED ABOVE.  IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
> RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION,
> DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
>     
> IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY
> NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
> THANK YOU.
>
>
> ------------------------------------------------------------------------
> Share life as it happens with the new Windows Live. Share now!
> <http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list