0%

centos7编译安装php7.2

常用到,记录一下

1
2
3
4
wget https://www.php.net/distributions/php-7.2.25.tar.gz
tar zxvf php-7.2.25.tar.gz
cd php-7.2.25/
./configure --help
1
2
3
4
5
6
7
8
9
10
11
yum install -y systemd-devel libpng-devel openjpeg-devel libxml2-devel curl-devel libicu-devel libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel
./configure --prefix=/usr/local/php7 --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-openssl --enable-exif --disable-fileinfo --enable-ftp --with-gd --enable-mbstring --enable-zip --with-curl --enable-bcmath --with-fpm-systemd --enable-sockets --with-mhash --with-zlib --with-gettext --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --enable-pcntl --enable-opcache --enable-intl --enable-session
make
make install
---
ln -s /usr/local/php7/etc/ /etc/php7
cp php.ini-production /usr/local/php7/etc/php.ini
加入 zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/opcache.so
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

常用信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/phpdbg/phpdbg.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

---

Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/
Installing PHP CLI binary: /usr/local/php7/bin/
Installing PHP CLI man page: /usr/local/php7/php/man/man1/
Installing PHP FPM binary: /usr/local/php7/sbin/
Installing PHP FPM defconfig: /usr/local/php7/etc/
Installing PHP FPM man page: /usr/local/php7/php/man/man8/
Installing PHP FPM status page: /usr/local/php7/php/php/fpm/
Installing phpdbg binary: /usr/local/php7/bin/
Installing phpdbg man page: /usr/local/php7/php/man/man1/
Installing PHP CGI binary: /usr/local/php7/bin/
Installing PHP CGI man page: /usr/local/php7/php/man/man1/
Installing build environment: /usr/local/php7/lib/php/build/
Installing header files: /usr/local/php7/include/php/
Installing helper programs: /usr/local/php7/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php7/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php7/lib/php/
[PEAR] Archive_Tar - installed: 1.4.7
[PEAR] Console_Getopt - installed: 1.4.2
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.4.3
[PEAR] PEAR - installed: 1.10.9
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/php7/lib/php to your php.ini include_path
/app/php-7.2.25/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers: /usr/local/php7/include/php/ext/pdo/