Linux PHP series: the expansion and development.

Recommended for you: Get network issues from WhatsUp Gold. Not end users.


It has been a long time development of PHP extensions, while learning side development and summary, tired and happy.

The spirit of good forget it principle, decided to write out some problems in the development process, valuable, and common progress.

Due to personal level and written expression ability is limited, there is wrong, please point out, very grateful´╝ü

This series are under development in Linux, does not involve the development under Windows.

Get down to business:

First of all, development PHP extensions need person with what skills.?

  1. Familiar with Linux operation. After all, is under development in Linux.
  2. Familiar with PHP, C/C++
  3. Linux C/C++ debug and compile

The above three points is in the back of the series does not specifically detail place, not understand place still need us to study.

Second, we must first think about why to develop PHP extensions, for personal interest and desire to skills upgrading, or because of work and business needs?

The former is the personal interest, interest is the best teacher, I hope you and I together to keep on studying.

If the latter, there are some problems need to be thinking:

  1. Development of expansion than the use of PHP development of the same function cost and difficulty to higher
  2. Maintenance is not easy
  3. Some compatibility problems caused by system and PHP update

Accustomed to the development and maintenance of PHP simple, these problems could not get, so personal suggestion in the following situation development:

  1. The high efficiency requirements, especially the operation efficiency
  2. Function and business or association is very small, relatively abstract
  3. The basic function of won't change, and not very complicated
  4. Using the PHP functions can not be achieved or resource cannot access

Third, need to understand the expansion and development of good, can use will be affected by at least the following aspects:

  1. PHP source code version, developed under the PHP5.3.9 may not be able to use PHP5.2.17, vice versa. (PHP5.2.17 does not define a PHP_FE_END and ZEND_MOD_END two macros)
  2. Glibc and GCC version, extended compilation of different versions may not be mutually general.

Simple solutions.:

  1. Ensure the above test and development of real servers consistent. For example, in the development of my machine to the deployment of PHP5.2.17 and PHP5.3.9 two versions, for developing and debugging formal machine different versions of PHP expansion and compilation
  2. The expansion of the function as far as possible in the PHP also developed a, this can guarantee the server upgrades PHP extension or expansion of abnormal function can still normal use.

Fourth, the development environment of this series are as follows:

  1. CentOS release 6.4 (Final) 64

  2. gcc version 4.4.7, Glibc 2.12

  3. PHP 5.3.9 (DEBUG)

OK, Objective to the end, ready to enter the next "Linux PHP extension development series: two. A typical extension development

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Maximilian at October 23, 2013 - 10:17 PM