PHP7 tutorial column introduces how to install from source codeswoole

PHP7 source code installation
Steps
Unziptar - xjvf
configure
make
- ##make install
Installation upload download command
linux operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@VM_0_5_centos ~]# cd /home/[root@VM_0_5_centos home]# mkdir -p work/study/softpackage[root@VM_0_5_centos softpackage]# pwd/home/work/study/softpackage[root@VM_0_5_centos softpackage]# ll
total 14900-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2[root@VM_0_5_centos softpackage]# tar -xjvf php-7.2.29.tar.bz2
drwxrwxr-x 14 root root 4096 Mar 17 18:16 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2[root@VM_0_5_centos softpackage]# cd php-7.2.29/[root@VM_0_5_centos php-7.2.29]# yum install gcc----configure: error: libxml2 not found. Please check your libxml2 installation.----
total 8drwxr-xr-x 3 root root 4096 Apr 2 22:04 soft
drwxr-xr-x 3 root root 4096 Apr 2 21:44 softpackage[root@VM_0_5_centos study]# cd soft/php/[root@VM_0_5_centos php]#
[root@VM_0_5_centos php]# ./bin/php -m
1585836467[root@VM_0_5_centos php]#
# .bash_profile
# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrc
fi
# User specific environment and startup programsPATH= $PATH : $HOME /binexport PATHalias php=/home/work/study/soft/php/bin/php
[root@VM_0_5_centos php]# php -vPHP 7.2.29 (cli) (built: Apr 2 2020 22:03:18) ( NTS )Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
|
Copy after login
Transfer php.ini
1 2 3 | [root@VM_0_5_centos study]# cd softpackage/php-7.2.29/[root@VM_0_5_centos php-7.2.29]# pwd/home/work/study/softpackage/php-7.2.29[root@VM_0_5_centos php-7.2.29]# cp php.ini-development /home/work/study/soft/php/etc/[root@VM_0_5_centos ~]# cd /home/work/study/soft/php/etc/[root@VM_0_5_centos etc]# ll
total 80-rw-r--r-- 1 root root 1354 Apr 2 22:05 pear.conf-rw-r--r-- 1 root root 71232 Apr 2 22:17 php.ini-development[root@VM_0_5_centos etc]# mv php.ini-development php.ini[root@VM_0_5_centos php-7.2.29]# php -i | grep php.ini
Configuration File (php.ini) Path => /home/work/study/soft/php/lib[root@VM_0_5_centos php-7.2.29]# cd /home/work/study/soft/php/[root@VM_0_5_centos php]# mv ./etc/php.ini ./lib/
|
Copy after login
Upload swoole file package
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [root@VM_0_5_centos softpackage]# rz[root@VM_0_5_centos softpackage]# ll
total 17076drwxrwxr-x 17 root root 4096 Apr 2 21:55 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2-rw-r--r-- 1 root root 2217161 Apr 2 22:27 swoole-swoole-master.zip[root@VM_0_5_centos softpackage]# unzip swoole-swoole-master.zip
[root@VM_0_5_centos softpackage]# ll
total 17080drwxrwxr-x 17 root root 4096 Apr 2 21:55 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2
drwxr-xr-x 9 root root 4096 Jan 9 20:06 swoole-rw-r--r-- 1 root root 2217161 Apr 2 22:27 swoole-swoole-master.zip
Configuring for :PHP Api Version: 20170718Zend Module Api No: 20170718Zend Extension Api No: 320170718[root@VM_0_5_centos swoole]# ./configure --with-php-config=/home/work/study/soft/php/bin/php-config
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/work/study/softpackage/swoole':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
问题的根源是缺少必要的C++库。如果是CentOS系统,运行,如下命令解决:
yum install glibc-headers
yum install gcc-c++
|
Copy after login
Re-execute
1 2 3 4 | [root@VM_0_5_centos swoole]# ./configure --with-php-config=/home/work/study/soft/php/bin/php-config[root@VM_0_5_centos swoole]# make[root@VM_0_5_centos swoole]# make install[root@VM_0_5_centos swoole]# cd /home/work/study/soft/php/lib/php/extensions/no-debug-non-zts-20170718/[root@VM_0_5_centos no-debug-non-zts-20170718]# ll
total 17664-rwxr-xr-x 1 root root 3589814 Apr 2 22:04 opcache.a-rwxr-xr-x 1 root root 1979620 Apr 2 22:04 opcache.so-rwxr-xr-x 1 root root 12488337 Apr 2 22:41 swoole.so[root@VM_0_5_centos lib]# ll
total 80drwxr-xr-x 15 root root 4096 Apr 2 22:05 php-rw-r--r-- 1 root root 71232 Apr 2 22:17 php.ini[root@VM_0_5_centos lib]# vi php.ini
[root@VM_0_5_centos lib]# pwd/home/work/study/soft/php/lib
|
Copy after login
1 2 3 4 | 在php.ini文件中添加:extension=swoole.so
查看是否添加成功:php -m[root@VM_0_5_centos server]# php echo .php
^C[root@VM_0_5_centos server]# pwd/home/work/study/softpackage/swoole/examples/server
[root@VM_0_5_centos server]# netstat -anp|grep 9501[root@VM_0_5_centos server]# pwd/home/work/study/softpackage/swoole/examples/server
|
Copy after login
This work adopts the "CC Agreement", the author and the link to this article must be noted when reprinting
The above is the detailed content of Introducing the whole process of PHP7 source code installation swoole. For more information, please follow other related articles on the PHP Chinese website!