greenba Posted March 18, 2009 Share Posted March 18, 2009 Hello, I would like to execute a php file from shell. <?php $podaci = $_GET['podaci']; echo $podaci; ?> I cannot use: [root@server]#php scriptname.php?podaci=12 I get an error. What is the right syntax to use Thank you, G Quote Link to comment https://forums.phpfreaks.com/topic/150020-solved-execute-php-from-shell/ Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 If you down load Netbeans +php it comes with servers that will take care of the setup for you... Quote Link to comment https://forums.phpfreaks.com/topic/150020-solved-execute-php-from-shell/#findComment-787863 Share on other sites More sharing options...
Cory94bailly Posted March 18, 2009 Share Posted March 18, 2009 What is the error? Quote Link to comment https://forums.phpfreaks.com/topic/150020-solved-execute-php-from-shell/#findComment-787866 Share on other sites More sharing options...
kenrbnsn Posted March 18, 2009 Share Posted March 18, 2009 The $_GET array is not used when using PHP from the command line. What are you trying to do? The normal way of starting php from the command line is: # php -q -f yourfile.php You can also start an interactive php session (so you can type lines and see what they do) by doing # php -q -a If you do this make sure the first line you type is "<?php" or nothing will work. Ken Quote Link to comment https://forums.phpfreaks.com/topic/150020-solved-execute-php-from-shell/#findComment-787874 Share on other sites More sharing options...
greenba Posted March 19, 2009 Author Share Posted March 19, 2009 Thank you all, I have rewritten my script so I dont need the $_GET Quote Link to comment https://forums.phpfreaks.com/topic/150020-solved-execute-php-from-shell/#findComment-788367 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.