exec() function??

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

luisfsguerra1979
New php-forum User
New php-forum User
Posts: 4
Joined: Fri Oct 11, 2002 8:12 am

exec() function??

Postby luisfsguerra1979 » Fri Oct 11, 2002 8:19 am

Hi, i have windowsxp, apache 2.0.40 and php installed.


the above line would supposed to open the calculator, but it doesn't, please somebody help me?????

exec("c:\\windows\\system32\\calc.exe");



Luis Guerra
Universidade Lusiada
Portugal
luisfsguerra@fam.ulusiada.pt

ednark
New php-forum User
New php-forum User
Posts: 18
Joined: Fri Oct 04, 2002 8:09 pm

Postby ednark » Sun Oct 13, 2002 9:48 pm

ok i think you have a missunderstanding of what php does...

1) you request a webpage, http://somepage.php
2) apache tries to give you the page, ie finds that file in the server directory
3) apache pauses before returning that page because it notices that you have requested a .php file, and it should first execute the file, then return the results
4) apache opens up your php.exe, and passes it the .php page you requested
5) apache waits for php to stop running your code, it then takes the text results (which should be some html) and returns them as the webpage requested


nowhere in this process is apache supposed to open up a graphical window with a calculator for you... you may however be able to call calc.exe with some other command line parameters, which may return the result of your calculation, this you can have php print out as a string, whcih is allowed to be returned....

that having been said, there is no reason you would ever want to do that, as php has simple math functionality built right in....

you cannot make php to act as a manager for what windows you have open... at least not when using php and apache through a webserver...

hope this helps

DoppyNL

Postby DoppyNL » Sun Oct 13, 2002 11:10 pm

executing calc.exe (or any other program) in php will open that program on the server, not on the client!
Perhaps that can be done with javascript, but I know almost nothing about javascript.

Greetz Daan

luisfsguerra1979
New php-forum User
New php-forum User
Posts: 4
Joined: Fri Oct 11, 2002 8:12 am

Run calc.exe on the server

Postby luisfsguerra1979 » Mon Oct 14, 2002 1:32 am

I want to run calc.exe on the server, but it doesn't open

:lol:

DoppyNL

Postby DoppyNL » Mon Oct 14, 2002 1:36 am

I don't know how to do that, but im curious on why you want to start the calculator on the server?
Since it requires user-input to work you will have to be at the server itself to be able to use it. In that case you could simply start in you'reself in windows.

Greetz Daan

luisfsguerra1979
New php-forum User
New php-forum User
Posts: 4
Joined: Fri Oct 11, 2002 8:12 am

divx player

Postby luisfsguerra1979 » Mon Oct 14, 2002 1:42 am

well in fact is to open 'radlight' and automatically show a movie

:lol:


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 0 guests