I have placed the following code at the top of index.php:
if (!isset($_SERVER['REMOTE_ADDR'])){
$_SERVER['QUERY_STRING'] = $_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = implode('/', $argv) . '/';
}
Ive also hard coded the $system_开发者_C百科path var to: "/Users/derrick/Sites/website/system";
as well as the $application_folder to "/Users/derrick/Sites/website/admin";
I then run the following command from terminal:
php /Users/derrick/Sites/website/index.php user email
I then a get the normal CI page not found error, can anyone tell me why? (http://localhost/~derrick/website/index.php/user/email works from the normal browser)
Please note that this is for CI 2 and not CI 1
What exactly are you trying to do? Command line interaction works fine out of the box if you are cd'ed to the level of your index file without any changed.
php index.php controller method param1 param2
I have made a few changes after 2.0.0 which will go into 2.0.1 to allow this to work from any directory (to help crontab etc) so you can grab this if you know what you are doing on BitBucket, but still you don't need to mess around with any server variables to get it working.
精彩评论