PHP swoole extension installation method detailed tutorial, phpswoole Installation Method
Swoole supports PHP 5.3.10 and later versions. Therefore, before installing Swoole, install PHP 5.3.10 and later versions. Now we will introduce how to install and configure PHP in Windows.
Software Version:Php-5.3.1-Win32-VC6-x86.zip
This does not require additional installation of the. net library, so it is used. You can use another one.
1. PHP installation
Download the Zip file in green and decompress it.
2. Configuration
Find php. ini-development in the extracted root directory, which is the configuration file used for the development environment. There is also a php. ini-production, which is the configuration file used for the production environment. Use php. in-development to copy a copy and rename it to php. ini. Start editing.
Locate registe_globals = Off;
We recommend that you do not open it. The difference is that this value is used to open global variables, such as the value sent from the form. If this value is set to "Off ", you can only use "$ _ POST ['variable name'], $ _ GET ['variable name']" to obtain the sent value. If it is set to "On ", you can directly use the "$ variable name" to obtain the sent value. Of course, setting it to "Off" is safer, so that data transmitted between webpages is not intercepted easily. If this value is changed to "On", it depends On your own feeling. Is it important for security or convenience?
To enable php to call other modules, you can search by the extension keyword, locate the following, remove the semicolon before the option, and enable the support of this module.
The more modules are loaded, the more resources are occupied, which can be ignored. For example, to enable mysql support, find the following
; Extension = php_mysql.dll
Remove the preceding ";" comment.
All modules are placed in the ext directory under the php decompression Directory, which can be enabled as needed.
Error in loading module:
Sometimes, when Apache is started, the error "the specified module cannot be found" is prompted because the location of these module files is not specified and the keyword "extension_dir" is located ", modify the directory of your PHP module in Windows.
For example, if my PHP Directory is in D: \ PHP, configure
Extession_dir = "D: \ PHP \ ext"
In this way, no error is reported when Apache is started.
This section describes the simplest method. You can directly specify the php installation path and the ext path in it to the windows System Path-right-click "my computer" and select "properties ", select the "advanced" tab, click "environment variables", find the "Path" variable under "system variables", select, double-click or click "edit", and D: \ php; D: \ php \ ext "is added after the original value. Of course," D: \ php "is my installation directory, change it to your php installation directory, as shown in.
3. Work with Apache
Php combines modules with Apache to open the configuration file of Apache and locate the module to be loaded with the keyword "LoadModule,
Add the following two lines at the end:
LoadModule php5_module D:/php/php5apache2_2.dll
PHPIniDir "D:/php"
The first line "LoadModule php5_module D:/php/php5apache2_2.dll" indicates loading php in module mode, and the second line "PHPIniDir" D:/php "indicates the php configuration file php. the ini location is, of course, where "D:/php" should be changed to the directory you have previously selected for php decompression.
Php5apache2. dll and php5apache2_2.dll are included in the php decompression directory. Because our apache version is 2.2, we load the dll.
You can configure php5apache2_2.dll as needed.
Search by the keyword AddType application. You can define the PHP file type that can be executed,
Original article: AddType allows you to add to or override the MIME configuration
# File specified in TypesConfig for specific file types.
Join
AddType application/x-httpd-php. php
AddTypeapplication/x-httpd-php.html
Two lines, you can also add more, the essence is to add file types that can execute php, for example, if you add a line "AddTypeapplication/x-httpd-php .htm.pdf", the .htm file can also execute the php program. You can even add the last line "AddTypeapplication/x-httpd-php. txt, so that common text txt can also run php programs.
The basic configuration of PHP is complete.
How to install swoole extension in PHP:
Put php into environment variables after installation
# export PATH=/usr/local/php/bin:$PATH # export PATH=/usr/local/php/sbin:$PATH
After saving, enter the following command on the terminal:
# source ~/.bashrc
Then you can install the swoole extension. Go to the swoole extension to download the latest stable version. This article takes 1.8.5 as an example:
# wget https://github.com/swoole/swoole-src/archive/swoole-1.8.5-stable.tar.gz# tar zxvf swoole-1.8.5-stable.tar.gz# cd swoole-1.8.5-stable# phpize # ./configure # make && make install
Then add the Swoole extension to the php. ini file:
extension=swoole.so
Restart php-fpm:
# service php-fpm restart
Then, view the extension installation information. If swoole is seen in the listed extensions, the installation is successful:
php -m
The above is all the content of this article. I hope it will help you learn php programming.