


Installation method and detailed tutorial of swoole extension in PHP
This article mainly shares with you the swoole extension installation method and detailed tutorial in PHP. It is practical and of reference value. Interested friends can refer to it
Swoole supports PHP 5.3.10 and above version, so please install PHP 5.3.10 or above before installing Swoole. Now let’s introduce the PHP installation and configuration method under Windows.
Software version: php-5.3.1-Win32-VC6-x86.zip
This does not require additional installation of .net libraries , so I used this. Others can be used.
1.PHP installation
Use the green method, download the Zip file and extract it.
2. Configuration
Find php.ini-development in the root directory of the decompression, which is the configuration file used for the development environment; also There is a php.ini-production, this is the configuration file for the production environment. Using php.in-development, make a copy and rename it to php.ini. Start editing.
Location registe_globals =Off;
It is recommended not to open it. The difference is that this value is used to open global variables, such as the value sent by the form. If If this value is set to "Off", you can only use "$_POST['variable name'], $_GET['variable name']", etc. to get the sent value. If it is set to "On", you can use it directly. "$Variable name" to get the value sent. Of course, setting it to "Off" is safer and will not allow people to easily intercept the data transmitted between web pages. Whether this value is changed to "On" depends on your own feeling. Is safety or convenience more important?
In order to enable php to call other modules, you can search with the extension keyword and locate as follows. Remove the semicolon before the option to open support for this module.
The more modules loaded, it will occupy slightly more resources, which can be ignored. For example, to enable mysql support, find the following
;extension=php_mysql.dll
and remove the ";" comment in front.
All modules are placed in the ext directory under the php decompression directory and can be enabled as needed.
Error when loading module:
Sometimes when starting Apache, the error "The specified module cannot be found" will be prompted because these module files are not specified. Location, locate the keyword "extension_dir", and modify the directory for your PHP module under Windows.
For example, if my PHP directory is in D:\PHP, configure
exession_dir = "D:\PHP\ext"
In this way, no error will be reported when starting Apache.
Here is the simplest method to directly specify the PHP installation path and the ext path inside it to the Windows system path - right-click on "My Computer", "Properties", and select "Advanced" tab, click "Environment Variables", find the "Path" variable under "System Variables", select it, double-click or click "Edit", and add ";D:\php;D:\php\ext" to the original value At the end, of course, "D:\php" is my installation directory. You need to change it to your own PHP installation directory, as shown in the figure below, confirm everything.
3. Work together with Apache
php is combined with Apache in module mode, open the Apache configuration file, locate it with the keyword "LoadModule", and configure it to be loaded module,
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" refers to loading PHP in module mode. The second line "PHPIniDir "D:/php"" indicates the location of PHP's configuration file php.ini. Of course , where "D:/php" should be changed to the directory where php is decompressed that you selected previously.
There are both php5apache2.dll and php5apache2_2.dll in the php decompression directory. Because our apache version is 2.2, so load the dll
Use php5apache2_2.dll according to your own situation configuration.
Search with the keyword AddType application to define the file type that can execute php.
The original text is as follows: AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types. html
two lines, you can also add more, the essence is to add a file type that can execute php, for example, if you add a line "AddTypeapplication/x-httpd-php .htm", then the .htm file will also The php program can be executed. You can even add the previous line "AddTypeapplication/x-httpd-php .txt" so that ordinary text txt can also run the php program.
The basic configuration of PHP is completed.Continue with the introduction of the PHP swoole extension installation method:
After the installation is completed, put php into the environment variable
# export PATH=/usr/local/php/bin:$PATH # export PATH=/usr/local/php/sbin:$PATH
After saving , enter the command in the terminal:
# source ~/.bashrc
Then you can install the swoole extension. Please go to the swoole extension download address 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 check the extension installation status. If you see swoole among the listed extensions, the installation is successful:
php -m
Summary: The above is the entire content of this article, I hope It can be helpful to everyone’s study.
Related recommendations:
Detailed explanation of examples returned by PHP implementation function reference
PHP solves the problem of rabbits giving birth to rabbits based on recursive algorithm
Sharing a simple method to achieve page staticization in PHP
# #
The above is the detailed content of Installation method and detailed tutorial of swoole extension in PHP. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
