Using shell_exec command, parameters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
markwelch
Forum Newbie
Posts: 12
Joined: Thu Mar 05, 2009 2:48 pm

Using shell_exec command, parameters

Post by markwelch »

I started a thread in viewtopic.php?f=1&t=96324&p=523920#p523920 and was encouraged to use the shell_exec command in order to execute a PHP script with no timeout. It was suggested that I could access a parameter using a (system?) variable called $argv[1] but I'm not able to get this working, nor can I find any hint as to how to correctly pass a parameter through a shell_exec command. I was given an example that uses a dash (-) before a parameter, but I cannot find any information to explain what is valid and what is not, nor whether $argv[1] value is something I must somehow define or manage.

Bottom line: I am back at Ground Zero. I need to create and run scripts to import some text files into a database. I cannot find any way to do this that does not require much more advanced knowledge of LAMP than I have -- and after spending dozens of hours, I cannot find any hint as to how to obtain the knowledge I need.

Thanks in advance for any help.
markwelch
Forum Newbie
Posts: 12
Joined: Thu Mar 05, 2009 2:48 pm

Re: Using shell_exec command, parameters

Post by markwelch »

After more trial and error, I confirmed that the dash should NOT be included before the parameter.

My tedious "ten steps forward, nine steps back" experience is continuing.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: Using shell_exec command, parameters

Post by kaisellgren »

Are you trying to execute a PHP script without time outs? Just use:

Code: Select all

ini_set('max_execution_time',0);
Post Reply