In order to learn swoole, I originally wanted to learn from the original cloud service for fear of messing up the previous cloud service. It just so happened that HUAWEI CLOUD recently had an event, registered a new user, purchased a cloud service with a 200 yuan voucher, learned swoole, and organized notes.
First compile and install php, and then compile and install swoole4.x in the next article
The service I bought is centos7.6.
It's cheap, so I recommend it by the way. Choose Huawei Cloud for servers! There are frequent activities, economical and affordable. When registering, remember to verify the
new user registration address: http://suo.im/6gMnrU
New users of 2-core 4G5M 40G hard drives only cost 707 yuan
Well, got an empty server, first of all we are going to use it!
First, download, compile and install the latest version of PHP, please go to the php official website to download:
Here I first create a new folder to store the source code package in the system, for example, I store it here
Before downloading and installing PHP7.4, you must first install various dependency packages
yum install -y openssl-devel libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel recode-devel libicu-devel libzip -devel sqlite-devel oniguruma-devel
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm
After installation, switch to /home/work/study/softpackage
Download the php source package
wget https://www.php.net/distributions/php-7.4.0.tar.gz
Unzip
tar -zxvf php-7.4.0.tar.gz
Switch to the unzipped directory
cd php-7.4.0
Next, check the configuration and install it in your customized directory. I installed it in /home/work/study/soft/php
first
This will happen if there is no problem
If you make here have reported the error, did not find makefile, this time we must check there is no installed gcc, or yum update you about
such ./configure configuration can not find the last encountered No package 'sqlite3' found,
resolve method:
yum install sqlite-devel
When this error occurs, the
solution:
add the configuration in quotation marks to the php installation configuration file -disable-fileinfo
, that is, add the --disable-fileinfo parameter when executing ./configure to
clear the original compilation make clean
and regenerate the makefile file
./configure --prefix=/home/work/study/soft/php --with-apxs2=/usr/local/apache/bin/apxs --with-curl --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 --disable-fileinfo
Then there is make make install
the
At this time, PHP has been compiled and installed.
We focus on using the php.ini file, we can get it this way, go to the PHP7.4 directory
Copy to etc
Simplify PHP execution commands
1 Edit this directory
2 Insert, this path is your php path
3 source this directory
At this time, you can use php -v directly
php.ini is to be placed in the lib directory, we can use this command to check,
so we need to put the php.ini mv from cp into the lib
Use an example to test test.php
At this point, the PHP compilation and installation have been completed
Systematic learning PHP
Scan code attention: PHP self-study center, reply to the corresponding keywords, receive the following video tutorial
1 Vue2.5 core technology source code analysis
Reply in the public account: 19082201
2 Analysis and in-depth interpretation of design pattern examples
. Reply in the public account: 20190714
3 PHP Advanced Practical Tutorial Complete Works
Reply in the public account: 20190625
4 Zero-distance contact with mysql
Reply in the public account: 20190128
5 The actual combat of building a high-performance Linux server
Reply in the public account: 20190622
6 Analysis of the underlying source code of
ThinkPHP5 Reply in the public account: 20190621
7 Thinkphp plug-in development of WeChat system
Reply in the public account: 201907282319
8 Introduction to Laravel basics to actual development in WeChat mall
. Reply in the public account: 08250045
9 PHP Asynchronous Communication Framework Swoole Actual Combat
Reply in the public account: 08250024
For more keywords of the tutorial, please pay attention to the articles and tutorials shared by the official account every day