Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2005, 11:24 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running cmd line .EXE through PHP

Hello to all!
I have a little problem...
I want to run a .exe file using php in Microsoft Windows XP. What i want to do is run a program for embedding a watermark in an image. So i have the agent.exe file that inserts the watermark into the image.
In windows I type simply in the command line: "agent path\blah-blah.jpeg path\blah-blah-new.jpeg". Now i want to do this through php for a website that I am developing...
I am new in php so I would like a little help.
Which is the right way? First use exec to call cmd.exe from WINDOWS\system32? Then use exec typing what i said above to watermark the image?
Even if it is so simple I tried it and the command exec('C:\WINDOWS\system32\cmd.exe'); doesn't do anything...

HEEELP...

Thanx in advance!!!

All you have to decide is what to do with the time that is given to you...
 
Old January 6th, 2005, 02:30 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Someone help pleeeeeeeease... :(

All you have to decide is what to do with the time that is given to you...
 
Old January 6th, 2005, 02:34 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Commands can be executed by enclosing the command in backticks.

$result = `agent path\blah-blah.jpeg path\blah-blah-new.jpeg`;

The results of the command are assigned to the variable.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design





Similar Threads
Thread Thread Starter Forum Replies Last Post
running a batch file from cmd from C# Bill_Thompson C# 2 March 29th, 2008 07:56 AM
how to call shell cmd to open exe on clientside? nana Javascript How-To 6 May 25th, 2006 03:23 AM
Permission Denied using ftp cmd line avonsteen Classic ASP Components 0 May 11th, 2005 08:50 AM
PHP5 and php.exe php-cgi.exe php-win.exe freddo Beginning PHP 1 August 16th, 2004 09:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.