For whatever reason, when I read this article, you need PHP extension development by default. This article will be divided into three series, from installation, simple implementation of an extension, to in-depth understanding of the extension mechanism and related APIs. This also plans to write down some of your PHP extension development experience and records over the past few years.
Preface
In several cases, PHP extension development is required:
- Resources or calls that PHP itself cannot access can be implemented through extension.
- It is better to use C for performance and efficiency considerations.
- In commercial or code protection considerations, encapsulate the code
- For a better understanding of PHP, get started here
For whatever reason, when I read this article, you need PHP extension development by default. This article will be divided into three series, from installation, simple implementation of an extension, to in-depth understanding of the extension mechanism and related APIs. This also plans to write down some of your PHP extension development experience and records over the past few years.
Preparations
PHP extension development requires a PHP environment installed with source code. from a simple perspective, we recommend our company's open-source project MooENV.
This is an open-source project for the automatic deployment of the LAMP environment. At present, it is mainly maintained by the company's O & M colleagues. It is especially suitable for VPS or virtual machine one-click installation environments. it is not recommended if it is too many. let's get started.
Install Git
To install Git under CentOS 5.x, you need to compile it by yourself. for details, refer to the article "install Git on CentOS"; directly under CentOS 6.x
You can.
Install MooENV
First, clone the source code git of MooENV to the local machine to start the installation. follow the steps below to continue.
Git clone git: // github.com/Ismole/MooENV.git |
Cd MooENV/ |
Dmesg-c # The main purpose of this step is to clear system-level errors. if a system-level error occurs, MooENV cannot be installed any more. here, by default, you can install MooENV on a virtual machine, so ignore it directly. |
./Install. sh |
The following describes how to install MooENV.
Do You Agree To The Terms Of This License? (Y/N) |
# Y is required. |
|
=== Which Integrate Environment You Want? === |
1: L. N. M.P-Nginx/PHP-FastCGI/MySQL/NoSQL |
2: L.A. M.P-Apache/PHP/MySQL/NoSQL |
# Select Apache or Nginx based on your preferences |
|
Do you want to change default YUM mirror to others? (Y/n) |
# I select y for the new system and upgrade YUM for the new system. |
SELECT YUM MIRROR |
1. 163-http://mirrors.163.com |
2. Sohu-http://mirrors.sohu.com |
3. Custom-Manually input URL |
Which YUM Mirror Do You Want To Use? (1/2/3 ): |
# I usually select 163 YUM image |
|
Do you want to perform a YUM update now? (Y/n) |
# Whether to upgrade YUM immediately. we recommend that you upgrade YUM. |
|
# The installation process of the dependent database |
|
=== Set MySQL root password === |
* ** Input password: |
# Enter the MySQL root password |
|
=== Environment Backup Setting === |
Do you want to add backup job to system cron? (Y/N) |
# Add automatic backup? |
|
=== System Services Configuration === |
Do you want Web Server start at boot time? (Y/N) |
# Whether to automatically start Nginx or Apache |
Do you want MySQL Server start at boot time? (Y/N) |
# Whether to automatically start MySQL |
PHP installation complete
In the future, the most commonly used directory will be the PHP source code directory, which may be
cd MooENV/src/php-5.3.8/ext/ |
After the content of this article is complete, you may see the following picture. the focus of this article is to recommend MooENV, haha.