PHP command line mode under linux

WBOY
Release: 2016-09-27 14:18:07
Original
980 people have browsed it

PHP command line mode under linux
Masters, there is an index.php file in the root directory of the website. The content can be output normally when accessed through a browser, but when I execute php index.php in the Linux system, it cannot be explained. Is my method wrong? What should I do?

Reply content:

Masters, there is an index.php file in the root directory of the website. The content can be output normally when accessed through a browser, but when I execute php index.php in the Linux system, it cannot be explained. Is my method wrong? What should I do?

<code>PHP安装目录/bin/php -v
PHP安装目录/bin/php-cgi -v
# 可以看到PHP版本信息的话,则执行:
export PATH=$PATH:PHP安装目录/php/bin</code>
Copy after login
PHP command line mode under linuxCan’t see the information, go and install PHP related packages
You need to install the php command line interpreter first, for example, Ubuntu/Debian can do this:
<code>sudo apt-get install php5-cli
sudo apt-get install php7.0-cli</code>
Copy after login

Several SAPI corresponding packages for PHP:

<code>apt-cache search php7.0
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template