SoFunction
Updated on 2025-03-10

Introduction to the entire process of installing php7 under mac

Update the system library

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

Install pcre regular expression library

cd /usr/local/src
//wget ftp:///pub/software/programming/pcre/pcre-8.
wget ftp:///pub/software/programming/pcre/pcre-8.
tar -zxvf pcre-8.
cd pcre-8.40
./configure
make && make install

Install Zlib library

cd /usr/local/src
//wget /zlib-1.2.
wget /zlib-1.2.
tar -zxvf zlib-1.2.
cd zlib-1.2.11
./configure
make && make install

Install the SSL library

cd /usr/local/src
//wget /source/openssl-1.0.
wget /source/openssl-1.1.
tar -zxvf openssl-1.1.

Install nginx

cd /usr/local/src
wget /download/nginx-1.10.
tar -zxvf nginx-1.10.
cd nginx-1.10.3
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/ --pid-path=/usr/local/nginx/ --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

An error occurred, you need to reinstall mcrypt

error: not found. Please reinstall libmcrypt.

 wget ftp:///pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5. 
tar -zxvf libmcrypt-2.5. 
cd libmcrypt-2.5.7 
./configure 
make && make install

Install the library

echo "/usr/local/lib">> /etc//
ldconfig -v

Install php7

cd /usr/local/src
wget /distributions/php-7.1.
tar -zxvf php-7.1.
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 -production /usr/local/php/lib/

Modify php user

 cd /usr/local/php/
 cp etc/ etc/
 cp etc// etc//
 groupadd www
 useradd -g www www
 vim etc//
    Modify the configurationuserandgroupChange towww
 vim /usr/local/nginx/

Modify nginx configuration

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

Install mysql5.6

Download mysql5.6

cd /usr/local/src/
wget /get/Downloads/MySQL-5.6/mysql-5.6.

Install cmake

cd /usr/local/src/
     wget /files/v3.5/cmake-3.5.
     tar xzvf cmake-3.5.
     cd cmake-3.5.2
     ./bootstrap
     gmake
     gmake install

Install mysql

cd /usr/local/src/
groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.6.
cd mysql-5.6.30
cmake .
make && make install
chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql/
rm -rf /etc/
scripts/mysql_install_db --user=mysql
cp support-files/ /etc/

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

cp support-files/ /etc//mysql
chmod +x /etc//mysql
chkconfig mysql on
service mysql start

Modify authorization

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;

Install git

yum -y install lrzsz
 yum -y install openjade texinfo perl 
 rpm -ivh /epel/6Server/x86_64/docbook2X-0.8.8-1.el6.x86_64.rpm (centos6)
 rpm -ivh /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 /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

Install php's yaf and redis extensions

cd /usr/local/src
wget /get/yaf-3.0.
 tar -zxvf yaf-3.0.
 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 /phpredis/phpredis/zip/php7
 unzip 
 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/
 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/
 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/

 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/

Install redis

 cd /usr/local/src/
 //wget /releases/redis-3.2.
 wget /
 //tar xzf redis-3.2.
 tar xzf 
 cd redis-3.2.8
 cd redis-stable
 make

 cp src/redis-server /etc//redis
 cp  /etc/
 chmod +x /etc//redis
 service redis /etc/ &

The above introduction to the entire process of installing php7 under Mac is all the content I share with you. I hope you can give you a reference and I hope you can support me more.