mac 下安装php7全过程介绍

更新系统库

rush:xhtml;"> yum -y install gcc gcc-c++ automake autoconf libtool make lrzsz expect asciidoc xmlto expat-devel.x86_64 texinfo

yum -y install gcc gcc-c++ glibc libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

安装pcre 正则表达式库

rush:xhtml;"> cd /usr/local/src //wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz tar -zxvf pcre-8.40.tar.gz cd pcre-8.40 ./configure make && make install

安装Zlib库

rush:xhtml;"> cd /usr/local/src //wget http://zlib.net/zlib-1.2.8.tar.gz wget http://zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make && make install

安装SSL库

rush:xhtml;"> cd /usr/local/src //wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz tar -zxvf openssl-1.1.0e.tar.gz

安装Nginx

rush:xhtml;"> cd /usr/local/src wget http://Nginx.org/download/Nginx-1.10.3.tar.gz tar -zxvf Nginx-1.10.3.tar.gz cd Nginx-1.10.3 ./configure --sbin-path=/usr/local/Nginx/Nginx --conf-path=/usr/local/Nginx/Nginx.conf --pid-path=/usr/local/Nginx/Nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.40 --with-zlib=/usr/local/src/zlib-1.2.11 --with-openssl=/usr/local/src/openssl-1.1.0e make && make install

出现报错,要重新安装mcrypt

error: mcrypt.h not found. Please reinstall libmcrypt.

rush:xhtml;"> wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz tar -zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 ./configure make && make install

安装库

/etc/ld.so.conf.d/local.conf ldconfig -v

安装PHP7

rush:xhtml;"> cd /usr/local/src wget http://cn2.PHP.net/distributions/PHP-7.1.3.tar.gz tar -zxvf PHP-7.1.3.tar.gz cd PHP-7.1.3 ./configure --prefix=/usr/local/PHP \ --with-mcrypt \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-MysqLi \ --with-openssl \ --with-pcre-regex \ --with-pdo-MysqL \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip make && make install cp PHP.ini-production /usr/local/PHP/lib/PHP.ini

修改PHP用户

rush:xhtml;"> cd /usr/local/PHP/ cp etc/PHP-fpm.conf.default etc/PHP-fpm.conf cp etc/PHP-fpm.d/www.conf.default etc/PHP-fpm.d/www.conf groupadd www useradd -g www www vim etc/PHP-fpm.d/www.conf 修改配置中的user和group改为www vim /usr/local/Nginx/Nginx.conf

修改Nginx配置

rush:xhtml;"> cd /usr/local/Nginx/ vim Nginx.conf include conf.d/*.conf; mkdir conf.d vim conf.d/www.conf server { listen 80; server_name xxxxx; root /var/www/xxxxx; location / { index index.PHP; } location ~ \.PHP { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; client_max_body_size 60m; include fastcgi_params; } if (!-e $request_filename) { rewrite ^/(.*) /index.PHP/$1 last; } }

安装MysqL5.6

下载MysqL5.6

rush:xhtml;"> cd /usr/local/src/ wget http://dev.MysqL.com/get/Downloads/mysql-5.6/mysql-5.6.30.tar.gz

安装cmake

rush:xhtml;"> cd /usr/local/src/ wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz tar xzvf cmake-3.5.2.tar.gz cd cmake-3.5.2 ./bootstrap gmake gmake install

安装MysqL

rush:xhtml;"> cd /usr/local/src/ groupadd MysqL useradd -g MysqL MysqL tar xzvf mysql-5.6.30.tar.gz cd mysql-5.6.30 cmake . make && make install chown -R MysqL:MysqL /usr/local/MysqL cd /usr/local/MysqL/ rm -rf /etc/my.cnf scripts/MysqL_install_db --user=MysqL cp support-files/my-default.cnf /etc/my.cnf

vi /etc/profile
PATH=/usr/local/MysqL/bin:$PATH
export PATH
source /etc/profile

cp support-files/MysqL.server /etc/init.d/MysqL
chmod +x /etc/init.d/MysqL
chkconfig MysqL on
service MysqL start

修改授权

rush:xhtml;"> MysqL -uroot -p use MysqL select host,user,password from user; delete from user where user = ''; update user set password = PASSWORD('1234qwer') where user = 'root'; //update user set host = '%' where user = 'root'; flush privileges;

安装git

rush:xhtml;"> yum -y install lrzsz yum -y install openjade texinfo perl perl-XML-SAX.noarch rpm -ivh http://mirror.nl.leaseweb.net/epel/6Server/x86_64/docbook2X-0.8.8-1.el6.x86_64.rpm (centos6) rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/d/docbook2X-0.8.8-17.el7.x86_64.rpm (centos7) cd /usr/bin/ ln -s db2x_docbook2texi docbook2x-texi cd /usr/local/src wget https://codeload.github.com/git/git/zip/v2.8.3 unzip v2.8.3 cd git-2.8.3 make prefix=/usr install install-doc install-html install-info (yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker) make install

安装PHP的yaf、redis扩展

rush:xhtml;"> cd /usr/local/src wget https://pecl.PHP.net/get/yaf-3.0.4.tgz tar -zxvf yaf-3.0.4.tgz cd yaf-3.0.4 /usr/local/PHP/bin/PHPize ./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config make && make install

cd /usr/local/src
wget https://codeload.github.com/PHPredis/PHPredis/zip/PHP7
unzip PHPredis-PHP7.zip
cd PHPredis-PHP7
/usr/local/PHP/bin/PHPize
./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config
make && make install

vim /usr/local/PHP/lib/PHP.ini
extension=/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20151012/yaf.so
extension=/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20151012/redis.so

extension=/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20160303/yaf.so
extension=/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20160303/redis.so

安装redis

rush:xhtml;"> cd /usr/local/src/ //wget http://download.redis.io/releases/redis-3.2.80.tar.gz wget http://download.redis.io/redis-stable.tar.gz //tar xzf redis-3.2.8.tar.gz tar xzf redis-stable.tar.gz cd redis-3.2.8 cd redis-stable make

cp src/redis-server /etc/init.d/redis
cp redis.conf /etc/redis.conf
chmod +x /etc/init.d/redis
service redis /etc/redis.conf &

以上这篇mac 下安装PHP7全过程介绍就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...