php - 如何从命令行运行 PHP 7...?

标签 php ubuntu php-7

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 - 如何从命令行运行 PHP 7...?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36366998/

相关文章:

php - 方法声明后的冒号?

php - PDO 中的 mysql_result 是什么?

php - 我需要未知数量的坐标字段(或几个字段)如何去做?

ruby - rbenv 构建在 Ubuntu 14.04 上失败

php - php spaceship operator 究竟如何比较字符串、数组和对象

laravel - 有没有人让 memcached 在 Laravel Homestead php7 盒子上工作?

php - Mysql哪里喜欢还是喜欢

PHP:如何检查查询字符串或 POST 变量是否两次包含相同的变量

MySQL:无法访问 root 或命令提示符

linux - 如何优化此 nginx 代理缓存配置?