如何从命令行 运行 PHP 7...?
How to run PHP 7 from command line...?
PHP 7 已安装。在 php 中有一个测试脚本。正在尝试从命令行启动。
[root@/php]# vim db_connect.php
[root@/php]# php db_connect.php
The program 'php' is currently not installed. You can install it by typing: apt-get install php5-cli
[root@/php]# php7 db_connect.php
No command 'php7' found, did you mean:
[root@/php]# php-7 db_connect.php
php-7: command not found
[root@/php]# php -v
The program 'php' is currently not installed. You can install it by typing:
apt-get install php5-cli
[root@/php]# apt-get install php7-cli
E: Unable to locate package php7-cli
使用 php7 启动的命令是什么?
正在安装 php7.0-cli 修复它。
apt-get install php7.0-cli
[root@/php]# php -v
PHP 7.0.5-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
[root@/php]# php db_connect.php
test
PDO connection object created
PHP 7 已安装。在 php 中有一个测试脚本。正在尝试从命令行启动。
[root@/php]# vim db_connect.php
[root@/php]# php db_connect.php
The program 'php' is currently not installed. You can install it by typing: apt-get install php5-cli
[root@/php]# php7 db_connect.php
No command 'php7' found, did you mean:
[root@/php]# php-7 db_connect.php
php-7: command not found
[root@/php]# php -v
The program 'php' is currently not installed. You can install it by typing:
apt-get install php5-cli
[root@/php]# apt-get install php7-cli
E: Unable to locate package php7-cli
使用 php7 启动的命令是什么?
正在安装 php7.0-cli 修复它。
apt-get install php7.0-cli
[root@/php]# php -v
PHP 7.0.5-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
[root@/php]# php db_connect.php
test
PDO connection object created