Introduction to the whole process of installing php7 under mac

  • 2021-09-16 06:32:40
  • OfStack

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

Installing the pcre Regular Expression Library


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

Install the Zlib library


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

Install the SSL library


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

Installing nginx


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

An error has been reported. Reinstall mcrypt

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


 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

Installation library


echo "/usr/local/lib">> /etc/ld.so.conf.d/local.conf
ldconfig -v

Installing php7


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

Modify php users


 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
     In the configuration user And group Replace with www
 vim /usr/local/nginx/nginx.conf

Modify nginx configuration


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;
  }
}

Installing mysql 5.6

Download mysql 5.6


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
0

Installing cmake


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
1

Installing mysql


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
2

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;

Installing git


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
4

Install yaf, redis extensions for php


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
5

Installing redis


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
6

Related articles: