Jump to content

Recommended Posts

hello everyone,

 

i have some questions about the exec() function..

 

first off.. will this function execute from START>RUN or from CMD?

 

I have an application I wish to run via the START>RUN and I need to trigger it from php..

 

hope I am explaining this decent enough for you guys to understand what I'm wanting to do.

 

thanks,

eff

Link to comment
https://forums.phpfreaks.com/topic/121399-solved-execrun/
Share on other sites

Basically it allows you to execute commands as if you were on the cmd line of your respective system, so if you run the script with exec() on a windows machine it's the same as using a cmd prompt, if you run it on linux it's the same as using a bash shell prompt. Linux however is strict about permissions, so you're only going to be able to run commands that Apache has privileges to run, however I cannot speak for what windows will allow you to do ;)

Link to comment
https://forums.phpfreaks.com/topic/121399-solved-execrun/#findComment-625923
Share on other sites

well i've tested wether or not what I want to do will run.. I just wanted to know if it would run on cmd or RUN, through the php exec() function, but I kinda already knew it in my head it was CMD..

thanks for confirming..

 

I guess if I added winrar to the windows %PATH% then it should work from CMD

 

thanks for your response aschk,

eff

 

 

Link to comment
https://forums.phpfreaks.com/topic/121399-solved-execrun/#findComment-625925
Share on other sites

I have been toying around with this for a few minutes tho..

 

I can get it to work in the CMD if I use the CHDIR command and change the directory to the winRAR directory..

 

then it allows me to use the WinRAR command... I also trying adding in the path to the windows enviroment variables path.. but to no avail.

 

I'm wondering tho..

 

if I was to say something like:

 

<?php

 

exec('CHDIR c:\program files\winrar\');

 

exec('WinRAR <my winrar command code>');

 

 

would that work?

 

or would the second time exec is run it would be back at the default directory?

 

thanks,

eff

Link to comment
https://forums.phpfreaks.com/topic/121399-solved-execrun/#findComment-626015
Share on other sites

well you not quite off, they do include rar.exe for commandline but it is extremely limited.

 

all is well I've been reading their documentation and decided to recheck my entry into the windows %PATH%

using other program entries as a ref I found I shouldn't have added the program name WinRAR.exe...

 

I took that off and just placed c:\Program Files\WinRAR\ in the path.. now its letting me run from the CMD..

so I think this is resolved..

 

THANKS ALOT GUYS!!!

lots of good suggestions,

 

eff

 

@dark...Create

Link to comment
https://forums.phpfreaks.com/topic/121399-solved-execrun/#findComment-626040
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.