How to pass parameters from bash to php script? -


i have done a bash script run php script. works fine without parameters when add parameters (id , url), there errors:

php deprecated:  comments starting '#' deprecated in /etc/php5/cli/conf                                                                                        .d/mcrypt.ini on line 1 in unknown on line 0 not open input file: /var/www/dev/dbinsert/script/automatisation.php?                                                                                        id=1 

i run php script bash this:

php /var/www/dev/dbinsert/script/automatisation.php?id=19&url=http://bkjbezjnkelnkz.com 

call as:

php /path/to/script/script.php -- 'id=19&url=http://bkjbezjnkelnkz.com' 

also, modify php script use parse_str():

parse_str($argv[1]); 

if index $_server['remote_addr'] isn't set.


more advanced handling may need getopt(), parse_str() quick'n'dirty way working.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -