mac升级到php7

Mac升级到php7

使用homebrew安装php7

brew update  #更新源
brew search php #查找源中的php,发现有php7.1版本,安装最新的php7.1
brew install php71

安装完之后

php -v
localhost:promotion wyc$ php-fpm -v
PHP 5.5.36 (fpm-fcgi) (built: May 29 2016 01:07:24)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

发现仍然是mac自带的php5.5

which php  #显示可执行文件在/usr/bin/php,而我们暗转的php7在/usr/local/bin/php

php和php-fpm分别在/usr/local/bin/和/usr/local/sbin,在shell中将会按照path的顺序依次寻找,所以讲/usr/local/sbin:/usr/local/bin加到path的头部就好,加到尾部,则还是寻找到/usr/bin下面的可执行文件

echo $PATH  #/usr/bin:/bin:/usr/sbin:/sbin
vi ~/.bash_profile
写入:export PATH="/usr/local/sbin:$PATH"
source ~/.bash_profile

这是加入到用户变量里面,可以加入到系统变量里面,vi /etc/paths 然后添加自己的变量

再次运行php -v 和php-fpm -v

PHP 7.1.5 (cli) (built: May 23 2017 11:45:41) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

显示的就是新版本的php

centos升级到php7及安装拓展

我的centos版本:CentOS Linux release 7.5.1804 (Core)

yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum install scl-utils
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 安装拓展:
yum install -y httpd mysql-community-server mysql-community-client mysql-community-bench mysql-community-devel php70 php70-build php70-php php70-php-ast php70-php-bcmath php70-php-cli php70-php-common php70-php-dba php70-php-dbg php70-php-devel php70-php-embedded php70-php-enchant php70-php-fpm php70-php-gd php70-php-geos php70-php-gmp php70-php-imap php70-php-interbase php70-php-intl php70-php-ioncube-loader php70-php-json php70-php-ldap php70-php-libvirt php70-php-libvirt-doc.noarch php70-php-litespeed php70-php-lz4 php70-php-mbstring php70-php-mcrypt php70-php-mysqlnd php70-php-oci8 php70-php-odbc php70-php-opcache php70-php-pdo php70-php-pdo-dblib php70-php-pear.noarch php70-php-pecl-amqp php70-php-pecl-apcu php70-php-pecl-apcu-bc php70-php-pecl-apcu-devel php70-php-pecl-apfd php70-php-pecl-apm php70-php-pecl-bitset php70-php-pecl-cassandra php70-php-pecl-couchbase2 php70-php-pecl-crypto php70-php-pecl-dbase php70-php-pecl-dio php70-php-pecl-druid php70-php-pecl-ds php70-php-pecl-eio php70-php-pecl-env php70-php-pecl-ev php70-php-pecl-event php70-php-pecl-fann php70-php-pecl-gearman php70-php-pecl-gender php70-php-pecl-geoip php70-php-pecl-geospatial php70-php-pecl-gnupg php70-php-pecl-grpc php70-php-pecl-hdr-histogram php70-php-pecl-hprose php70-php-pecl-hrtime php70-php-pecl-http php70-php-pecl-http-devel php70-php-pecl-igbinary php70-php-pecl-igbinary-devel php70-php-pecl-imagick php70-php-pecl-imagick-devel php70-php-pecl-inotify php70-php-pecl-json-post php70-php-pecl-krb5 php70-php-pecl-krb5-devel php70-php-pecl-libsodium php70-php-pecl-lua php70-php-pecl-lzf php70-php-pecl-mailparse php70-php-pecl-memcache php70-php-pecl-memcached php70-php-pecl-memprof php70-php-pecl-mogilefs php70-php-pecl-mongodb php70-php-pecl-mosquitto php70-php-pecl-msgpack php70-php-pecl-msgpack-devel php70-php-pecl-mysql php70-php-pecl-oauth php70-php-pecl-pcs php70-php-pecl-pcs-devel php70-php-pecl-pdflib php70-php-pecl-pq php70-php-pecl-propro php70-php-pecl-propro-devel php70-php-pecl-radius php70-php-pecl-raphf php70-php-pecl-raphf-devel php70-php-pecl-rdkafka php70-php-pecl-redis php70-php-pecl-ref php70-php-pecl-request php70-php-pecl-rrd php70-php-pecl-scrypt php70-php-pecl-seaslog php70-php-pecl-selinux php70-php-pecl-solr2 php70-php-pecl-ssdeep php70-php-pecl-ssh2 php70-php-pecl-stats php70-php-pecl-stomp php70-php-pecl-swoole php70-php-pecl-swoole-serialize php70-php-pecl-sync php70-php-pecl-taint php70-php-pecl-tcpwrap php70-php-pecl-termbox php70-php-pecl-trace php70-php-pecl-trader php70-php-pecl-ui php70-php-pecl-uopz php70-php-pecl-uploadprogress php70-php-pecl-uuid php70-php-pecl-uv php70-php-pecl-varnish php70-php-pecl-vips php70-php-pecl-vld php70-php-pecl-weakref php70-php-pecl-xattr php70-php-pecl-xdebug php70-php-pecl-xdiff php70-php-pecl-xmldiff php70-php-pecl-xmldiff-devel php70-php-pecl-xxtea php70-php-pecl-yac php70-php-pecl-yaf php70-php-pecl-yaml php70-php-pecl-yar php70-php-pecl-yaz php70-php-pecl-zip php70-php-pecl-zmq php70-php-pgsql php70-php-phalcon3 php70-php-phpiredis php70-php-pinba php70-php-process php70-php-pspell php70-php-recode php70-php-smbclient php70-php-snappy php70-php-snmp php70-php-soap php70-php-sqlsrv php70-php-tarantool php70-php-tidy php70-php-xml php70-php-xmlrpc php70-runtime php70-scldevel php70-zephir.noarch php70-zephir-parser
  • Laravel 5.6 要求 PHP 7.1.3 或更高(文章安装了PHP 7.2.7)
1.sudo yum -y install epel-release
2.sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
3.sudo yum install yum-utils
4.sudo yum-config-manager --enable remi-php72
5.sudo yum install php
6.sudo yum search php72 | more
7.sudo yum search php72 | egrep 'fpm|gd|mysql|memcache'
8.sudo yum install php72
9.sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache #拓展
1.php72 --modules
2.sudo systemctl enable php72-php-fpm.service
3.sudo systemctl start php72-php-fpm.service

安装redis拓展

mac不能通过brew安装redis拓展,所以可以通过源码安装。centos同样也可以这样:https://www.cnblogs.com/mentalidade/p/9658132.html

上一篇:使用OwnCloud搭建自己的云盘


下一篇:transition过度效果 + transform旋转360度