Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-08-2015, 07:21 PM   #1
Registered: Oct 2003
Location: Canada
Posts: 911

Rep: Reputation: 61
Running PHP from command line with $_GET

Hey LQ,

Just curious how I might pass a $_GET variable to a php script from the command line, if it's even possible.
Old 06-09-2015, 02:36 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
$first = $argv[1];
$scnd = $argv[2];

echo "first param is $first and second is $scnd \n";

Save the script above as test.php and call it

php test.php aah ooh

$_GET is empty.
1 members found this post helpful.


$_get, command line, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
running a php script from command line leicaphotos Linux - Newbie 1 10-10-2008 02:24 PM
Problems running PHP script in command line Hondro Linux - Software 1 06-21-2007 05:16 AM
Problems running PHP scrip in command line Hondro Programming 0 06-21-2007 03:39 AM
Globals in PHP and Smarty ($_GET) vargadanis Programming 6 12-01-2006 08:21 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration