Hello, please sign in or register
You are here: Home

Using PHP in CLI - command line interface

Preface

The command line interface does not include the same modules as the web browsing version of PHP.

To check which modules

// go the root of your php executable

C:\>  cd \wamp\php 

// Check available php modules

C:\wamp\php\ > php -m 

It took me the morning to figure out why PHP-CGI could execute MySQL functions while PHP-CLI could not. Reason being PHP-CGI and PHP-CLI look for it in different locations. Popular place for both is either

C:\windows\ or C:\PHP\

 Copy the PHP.ini file into the directory with PHP.exe.... you should now type php -m and find all the usual modules are there.

PHP-CLI options

This is just function help detail if you were to type man php in Linux, or php -help in windows

Usage: php [options] [-f]  [args...]

php [options] -r code [args...]

php [options] [-- args...]

-s Display colour syntax highlighted source.

-w Display source with stripped comments and whitespace.

-f file Parse file.

-v Version number

-c path|file Look for php.ini file in this directory

-a Run interactively

-d foo[=bar] Define INI entry foo with value 'bar'

-e Generate extended information for debugger/profiler

-z file Load Zend extension file.

-l Syntax check only (lint)

-m Show compiled in modules

-i PHP information

-r code Run PHP code without using script tags <?..?>



-h This help



args... Arguments passed to script. Use -- args when first argument

starts with - or script is read from stdin

External Resources

Comments

0921maoqiuyun
cheap nba jerseys, http://www.nbajerseys.net/ jordan shoes, http:/...
Created 21/09/15
1015maoqiuyun
coach outlet online, http://www.coachoutletonline-store.us.com/
Created 15/10/15
ninestab123
ninest123 One canada goose pas cher gucci outlet thing
Created 21/07/16
chenyingying
nike tn 2016 coach outlet online cheap nhl j...
Created 16/11/16
michael kors factory outlet
adidas nmd pandora bracelet
Created 16/05/17
wanglili
true religion outlet ralph lauren outlet michael kors...
Created 21/08/17
meadc
Oakley Sunglasses hermes belt
Created 09/09/17
Title*
Comment

Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Contact
Name*
Email never shown*
Home Page

Author

Andrew Dodson
Since:Feb 2007

Comment | flag

Categories

Bookmark and Share