前端之家收集整理的这篇文章主要介绍了
mac 下安装php7全过程介绍,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
更新系统库
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 正则表达式库
安装Zlib库
安装SSL库
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.
安装库
/etc/ld.so.conf.d/local.conf
ldconfig -v
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/
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/
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
MysqL.com/get/Downloads/
MysqL-5.6/
MysqL-5.6.30.tar.gz
安装cmake
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
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
安装PHP的yaf、redis扩展
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
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全过程介绍就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。