Local test Server Configuration

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
N1ck
Forum Newbie
Posts: 2
Joined: Tue Apr 15, 2008 8:25 pm

Local test Server Configuration

Post by N1ck »

Echo exec($cmd); wont run on my local test server

I need some guidance please. I am building a local test server to run an application which will launch an .exe file. My initial testing was done on WOSX (Webserver On a Stick http://www.chsoftware.net/en/products/wosx/wosx.htm ) and it worked fine. I used the following code to launch the file:
<?php
$cmd = '"c:\\ Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe"';
Echo exec($cmd);
?>
I also tried:
$cmd = '"c:\\ Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe"';
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmd, 7, false);

which also works

I have now built my test server running Apache_2.2.8-win32 and php-5.2.5-win32 but I can’t get the code to open the cmd window. I have spent all day trying to solve the problem but no joy. The problem is definitely in how I have configured the server because the code works when I run it on WOSX but not on my new server. If anyone has any suggestions on what I am doing wrong I’m all ears.

P.S. I tried this on Windows 2003 server and then on Win XP pro sp2
Thanks
Nick
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Local test Server Configuration

Post by Zoxive »

I'm not sure you realize how php works.

To put simply..
PHP has 0 knowledge of the client's computer, therefore can not launch programs.

What I believe you want is to send a pdf file to the browser, and have the client computer deal with it.
(Most computers automatically launch adobe acrobat when a pdf file is opened)

Code: Select all

<?php
header("Content-type:application/pdf");
 
// Download Window
header("Content-Disposition:attachment;filename='downloaded.pdf'");

Code: Select all

<?php
header("Content-type:application/pdf");
 
// Loads in the browser
readfile("original.pdf");
Post Reply