´iÎo£ºconfigure: error: libevent >= 1.4.11 could not be found
½a¾o£ºyum -y install libevent libevent-devel
´iÎo£ºconfigure: error: Please reinstall the mysql distributio
½a¾o£ºyum -y install mysql-devel
´iÎo£ºmake: *** [sapi/fpm/php-fpm] error 1
½a¾o£ºÓÃmake ZEND_EXTRA_LIBS='-liconv'±aÒe
´iÎo£ºconfigure: error: XML configuration could not be found
½a¾o£ºyum -y install libxml2 libxml2-devel
´iÎo£ºconfigure: error: No curses/termcap library found
½a¾o£ºyum -y install ncurses ncurses-devel
´iÎo£ºconfigure: error: xml2-config not found
½a¾o£ºyum -y install libxml2 libxml2-devel
´iÎo£ºconfigure: error: Cannot find OpenSSL's <evp.h>
½a¾o£ºyum install openssl openssl-devel
´iÎo£ºconfigure: error: Please reinstall the libcurl distribution -easy.h should be in
½a¾o£ºyum install curl curl-devel
´iÎo£ºconfigure: error: Cannot find ldap.h
½a¾o£ºyum install openldap openldap-devel
´iÎo£ºconfigure: error: libjpeg.(a|so) not found
½a¾o£ºyum install libjpeglibjpeg -devel
´iÎo£ºconfigure: error: libpng.(a|so) not found.
½a¾o£ºyum install libpnglibpng ¨Cdevel
´iÎo£ºonfigure: error: freetype.h not found.
½a¾o£ºyum install freetype-devel
´iÎo£ºconfigure: error: cannot find output from lex; giving up
½a¾o£ºyum -y install flex
´iÎo£ºconfigure: error: mod_deflate has been requested but can not be built due to prerequisite failures
½a¾o£ºyum -y install zlib-devel openssl-devel
´iÎo£ºConfigure: error: Unable to locate gmp.h
½a¾o£ºyum install gmp-devel
´iÎo£ºConfigure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
½a¾o£ºyum install mysql-devel
**¸u¶aµÄ²¹³aÄÚÈÝ£º
**°²×°php: ./configure
configure: error: XML configuration could not be found
yum -y install libxml2 libxml2-devel
Cannot find OpenSSL's <evp.h>
yum install openssl openssl-devel
Configure: error: xml2-config not found. Please check your libxml2 installation.
Checking for pkg-config¡ /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
Configure: error: Please reinstall the BZip2 distribution
Configure: error: Please reinstall the libcurl distribution -
easy.h should be in
Configure: error: libjpeg.(also) not found.
Configure: error: libpng.(also) not found.
Configure: error: freetype.h not found.
Configure: error: Unable to locate gmp.h
Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
Configure: error: Please reinstall the ncurses distribution
Checking for unixODBC support¡ configure: error: ODBC header file ¡®/usr/include/sqlext.h' not found!
Configure: error: Cannot find pspell
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Configure: error: snmp.h not found. Check your SNMP installation.
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
16£(C)
Ϊphp±aÒexcacheÄ£¿eµÄʱºo£¬ÐeÒªÔËÐÐphpize
µÃµ½ÁËÒ»¸o´iÎo
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
ͨ¹ý°²×° autoconf ¿ÉÒÔ½a¾o
centosÏÂÖ´ÐÐ yum install autoconf ¼´¿É
UbuntuÏÂÖ´ÐÐ apt-get install autoconf ¼´¿É
17£(C)
Cannot find config.m4.
Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module
Ð޸Ľ¨£º
[root@centos lnmp]# cd php-5.2.14ext/
[root@centos ext]# ./ext_skel --extname=my_module
Creating directory my_module
Creating basic files: config.m4 config.w32 .cvsignore my_module.c php_my_module.h CREDITS EXPERIMENTAL tests/001.phpt my_module.php [done].
To use your new extension, you will have to execute the following steps:
1. $ cd ..
2. $ vi ext/my_module/config.m4
3. $ ./buildconf
4. $ ./configure --[with|enable]-my_module
5. $ make
6. $ ./php -f ext/my_module/my_module.php
7. $ vi ext/my_module/my_module.c
8. $ make
Repeat steps 3-6 until you are satisfied with ext/my_module/config.m4 and
step 6 confirms that your module is compiled into PHP. Then, start writing
code and repeat the last two steps as often as necessary.
[root@centos ext]# cd my_module/
[root@centos my_module]# vim config.m4
¸u¾ÝÄa×Ô¼ºµÄÑ¡Ôñ½«
dnl PHP_ARG_WITH(my_module, for my_module support,
dnl Make sure that the comment is aligned:
dnl [ --with-my_module Include my_module support])
Ð޸ijÉ
PHP_ARG_WITH(my_module, for my_module support,
Make sure that the comment is aligned:
[ --with-my_module Include my_module support])
»oÕß½«
dnl PHP_ARG_ENABLE(my_module, whether to enable my_module support,
dnl Make sure that the comment is aligned:
dnl [ --enable-my_module Enable my_module support])
Ð޸ijÉ
PHP_ARG_ENABLE(my_module, whether to enable my_module support,
Make sure that the comment is aligned:
[ --enable-my_module Enable my_module support])
[root@centos my_module]# vim my_module.c
¡¡¡¡½«ÎļþÆaÖеÄÏÂÁдuÂe½øÐÐÐÞ¸Ä
/ Every user visible function must have an entry in my_module_functions[].
/
function_entry my_module_functions[] = {
¡¡¡¡¡¡¡¡PHP_FE(say_hello,¡¡¡¡¡¡ NULL)¡¡/ ?Ìi¼Ó×ÅÒ»ÐдuÂe /
¡¡¡¡¡¡¡¡PHP_FE(confirm_my_module_compiled,¡¡¡¡¡¡NULL) / For testing, remove later. /
¡¡¡¡¡¡¡¡{NULL, NULL, NULL}¡¡¡¡¡¡/ Must be the last line in my_module_functions[] /
};
¡¡¡¡ÔÚÎļþµÄ×iºoÌi¼ÓÏÂÁдuÂe
PHP_FUNCTION(say_hello)
{
¡¡¡¡¡¡¡¡zend_printf("hello sdomain!");
}
ÔÙÐ޸ģºphp_sdomain.h
vi php_sdomain.h
ÔÚPHP_FUNCTION(confirm_my_module_compiled ); / For testing, remove later. / ÕaÐеÄÏÂÃaeÌi¼ÓÒ»ÐУº
PHP_FUNCTION(say_hello); / For testing, remove later. /
¡¡¡¡±£´aeÎļþÍ˳o
¡¡¡¡È»ºoÎÒÃǾͿÉÒÔÔÚÕa¸oĿ¼ÏÂʹÓÃÉÏÃaeµÄÃuÁiÁË
¡¡¡¡/usr/local/php/bin/phpize
¡¡¡¡Ö´ÐÐÒÔºo»a¿´µ½ÏÂÃaeµÄ
¡¡¡¡[root@ns sdomain]# /usr/local/php/bin/phpize
¡¡¡¡Configuring for:
¡¡¡¡PHP Api Version:¡¡¡¡¡¡¡¡ 20020918
¡¡¡¡Zend Module Api No:¡¡¡¡¡¡20020429
¡¡¡¡Zend Extension Api No:¡¡ 20050606
¡¡¡¡[root@ns sdomain]#
¡¡¡¡È»ºoÖ´ÐÐ./configure --with-php-config=/usr/local/php/bin/php-config
¡¡¡¡È»ºoÖ´ÐÐmake
¡¡ make install
È»ºoËu»a°Ñ¶ÔÓ¦µÄsoÎļþÉu³Éŵ½PHP°²×°Ä¿Â¼ÏÂÃaeµÄÒ»¸oÎļþ¼Ð£¬²¢ÌaʾÔÚÔÚʲôµØ½£¬È»ºoÔÙ°ÑÀiÃaeµÄSOÎļþ¿½µ½Äa´aeÅSOÎļþµÄµØ½
¡¡¡¡¼´ÄaÔÚphp.iniÀiÃaeµÄextension_dirËuÖ¸¶¨µÄλÖÃ
¡¡¡¡×iºoÒ»²½ÊÇÄaÔÚphp.iniÎļþÖдo¿ªÕa¸oÀ(C)Õ¹
¡¡¡¡extension=sdomain.so
¡¡¡¡È»ºo
¡¡¡¡ÖØÐÂÆð¶¯apache
ÒÔÉÏ´iÎo¶¼ÊÇÔÚÕu¸o±aÒe°²×°Óoµ½µÄÎÊÌa£¬È»ºo½aºÏÍøÉϵÄ×ÊÁÏ£¬ÕÒµ½µÄ½a¾o½¨£¬×ܽaµ½Õa¸oµØ*½£¬Ï£ÍuÄÜ°iµ½´o¼Ò£¡