LAMP architecture (PHP5 installation, PHP7 installation)

PHP5 Installation

  1. download
wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
  1. decompression

Tip: Can't exec: No file or directory

The reason is that the bzip2 package is missing

yum install -y bzip2

decompression

tar -jxvf  php-5.6.32.tar.bz2
  1. To configure
1. Need to be installed first xml2

yum install -y libxml2-devel

2 Installation required openssl

yum install -y openssl-devel

3 Installation required bzip2

yum install -y bzip2-devel

4.Installation required libjpeg-turbo-devel

yum install -y libjpeg-turbo-devel

5. Installation required libpng-devel

yum install -y libpng-devel

6. Installation required libmcrypt-devel

*  because yum Without this source, you need to install it first 
yum install -y  epel-release
 
yum install -y libmcrypt-devel

 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

You can also configure mariadb here if you need to

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mariadb --with-pdo-mysql=/usr/local/mariadb --with-mysqli=/usr/local/mariadb/bin/mariadb_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
  • prefix: installation directory
  • with-apxs2:apache automatic management extension
  • with-config-file:apache automatically manages module configuration file paths
  • with-mysql, with-pdo-mysql, with-mysqli:php connection MySQL driver

Prompt error: freetype-config not found

yum install freetype-devel
  1. install
make && make install
  1. Copy profile to
  • Profile Interpretation
    • php.ini-production production environment file
    • php.ini-development development development test environment
cp  php.ini-production  /usr/local/php/etc/php.ini

Install php7

  1. download
wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
  1. decompression
tar jxvf php-7.1.6.tar.bz2
  1. Compile
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc  --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
  1. install
make && make install
  1. Copy profile to
cp php.ini-production /usr/local/php7/etc/php.ini

Expand

What is mysql,mysqli,mysqlnd,pdo in php http://blog.csdn.net/u013785951/article/details/60876816
View compilation parameters http://ask.apelearn.com/question/1295

Keywords: PHP MySQL yum OpenSSL

Added by gigantorTRON on Sat, 18 Jan 2020 19:54:04 +0200