Page 1 of 1

Using shell_exec command, parameters

Posted: Fri Mar 06, 2009 12:59 pm
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.

Re: Using shell_exec command, parameters

Posted: Fri Mar 06, 2009 1:21 pm
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.

Re: Using shell_exec command, parameters

Posted: Fri Mar 06, 2009 1:45 pm
by kaisellgren
Are you trying to execute a PHP script without time outs? Just use:

Code: Select all

ini_set('max_execution_time',0);