Use of the PHP CLI and extended installation

Source: Internet
Author: User
Tags php cli php print php source code sapi
PHP SAPI (Server application Programming Interface, service-side application programming port) support is called CLI. The CLI (command line Interface) is the shell mode that refers to PHP running in command line mode. In the Linux interface, after installing PHP, you can directly use the PHP command (the default path of PHP loaded into the command search path).

View the mode of the current SAPI php-v


You can see that the current PHP version is in CLI mode.

PHP Zend Engine is the V2.5.0 version (PHP code compilation Management Kernel)

Zend Guard Loader version is V3.3 (PHP running Code decryption tool Zend guard is the PHP source code encryption tool The current Zend Guard has reached 7.0, encrypted PHP files need the corresponding decryption device to run)

Zend Opcache (This is the PHP cache plug-in php5.5, can be used to replace the APC, Eaccelerator, XCache Accelerator plug-in principle is to buffer the PHP data into memory in order to avoid the duplication of the compilation process, Ability to directly use buffer-compiled code to increase speed and reduce server load

The direct operation of the PHP command is as follows:


You can use Php-r directly to run native PHP code can also directly php-f test.php this run php files.

If you want to give the parameters to the interior when running directly, you need to $argv to receive the parameters.


This is generally a limited scenario for running PHP code directly. For example, test the PHP print log, or check whether a function or extension is available, in most cases, it can be run directly with the file.

Php-f test.php This allows you to run the corresponding PHP file directly.

Sometimes it is necessary to check if the corresponding module is downloaded, such as to see if the Phalcon module is installed.

Php-m (the default PHP also has a lot of modules installed)


You can see a lot of built-in extension libraries inside. Most of the general PHP Extensions support scaling and reduction. Here is a summary of the installation of the Phalcon (built-in library installation example)

git clone git://github.com/phalcon/cphalcon.git (git pull-up project down)

CD cphalcon/build (switch to project directory)

Vim Install (Edit the installation file, it needs to fill in our Php-config address or not install)

./configure--enable-phalcon--with-php-config=/usr/local/php/bin/php-config (complete the./configure command./ Configure is the first step in the source code installation, and the main purpose is to configure the software to be installed to check whether the current environment meets the dependencies for installing the software)

Then sh install (start compiling installation)

You can see complete

Jump to

PHP.ini.

Finally add

Extension =phalcon.so

Then restart PHP-FPM

Service PHP-FPM Restart

You can see that the installation was successful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.