Get ready
Windows users can use the Cygwin environment to learn swoole, but there are a lot of problems, below we mainly introduce under the Linux environment Swoole installation.
PHP version recommended php5.4+, of course php7 is not a problem.
Most of our apps will be based on MAC+PHP7 later.
In addition, you should ensure that the following software is installed in the system
gcc-4.4+makeautoconf
GCC version is not enough or one of the above software is not installed, the following operation there is no need to look down.
Here are the two ways to install, choose freely
Compiling the installation
Swoole as an extension of PHP, the installation method is naturally no different from other extensions. Take a look at the specific steps
1, download the latest stable version, to PECL official website, we see the latest version is 1.9.6, the latter for Swoole study, we also use this version as a quasi, if the Local has been installed Swoole,
However, the version is inconsistent, you can directly see the following about the Swoole upgrade explanation. In addition, because Swoole is still very young, each version may be in conflict with the configuration we have described,
It is recommended that you ensure that your version is consistent with ours, unless you know the differences in the version itself.
We switch to the/USR/LOCAL/SRC directory, and you can download it to the path you want. Use wget download, prompt wget is not a command please download this command first
wget http://pecl.php.net/get/swoole-1.9.6.tgz
2, then use the TAR command decompression, the same tar command does not exist self-download
Tar zxvf swoole-1.9.6.tgz
3. Switch to swoole-1.9.6 directory
CD swoole-1.9.6
4, find the path of phpize, pay attention to the specific PHP version you want to install the phpize, such as my PHP source code in the/usr/local/opt/php70/directory,
Phpize path is/usr/local/opt/php70/bin/phpize, it is recommended to specify an absolute path when you are not sure which version of PHP Phpize is under the terminal
/usr/local/opt/php70/bin/phpize
Enter the above command at the terminal to return
5. Check && compile && install
./configuremake sudo make install
Enter the above command in turn.
PECL Installation
The process of compiling the installation is a little cumbersome, swoole is also a pecl project, so we can also install it via PECL
PECL Install Swoole
If all of the above steps are normal, that means the Swoole has been successfully installed.
After success, we open the php.ini (do not know where the configuration file to go back to see the CLI again), add swoole.so to the end of the file
Extension=swoole.so
Then use the command php-m to see if the Swoole is properly installed
$ php-m | grep swooleswoole
Seeing the result indicates that the installation was successful, and of course it was done smoothly during the installation process.
If there is a failure during the installation process, the following message feedback Oh.
Swoole Upgrade
Swoole is still in the development, perhaps we have not finished learning, the new version will come out again. Have a classmate to say, after a while I guess forget now installs of Swoole version is how much, this How to do?
We can view the Swoole version via the PHP--ri command
PHP--ri Swoole | grep Version # Version = 1.9.6
If there is a new version released later, how to upgrade swoole?
Compiling the upgrade
Compile the upgrade, only need to download the latest stable version from the PECL official website, follow our first compile and install the steps to go again on the finished. The previously installed version does not need to be asked, which is equivalent to reinstalling the new version.
Friendly reminder, as far as possible to download stable version, non-stable version may occur a lot of unexpected things.
PECL Upgrade
This is more simple, a command is done.
PECL Upgrade Swoole
The next section we are going to talk about the simple application of the next swoole, at the same time will be our final example of the foundation, look forward to leave a message, perhaps I can write in advance oh.
Reprint: White Wolf Stack
Installation and upgrade of PHP Swoole basic-swoole