{"id":1668,"date":"2017-01-16T13:47:17","date_gmt":"2017-01-16T05:47:17","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=1668"},"modified":"2017-01-16T13:47:17","modified_gmt":"2017-01-16T05:47:17","slug":"php%e6%ba%90%e4%bb%a3%e7%a0%81%e5%ae%89%e8%a3%85%e5%b8%b8%e8%a7%81%e9%94%99%e8%af%af%e4%b8%8e%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/php%e6%ba%90%e4%bb%a3%e7%a0%81%e5%ae%89%e8%a3%85%e5%b8%b8%e8%a7%81%e9%94%99%e8%af%af%e4%b8%8e%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%e5%88%86%e4%ba%ab\/","title":{"rendered":"php\u6e90\u4ee3\u7801\u5b89\u88c5\u5e38\u89c1\u9519\u8bef\u4e0e\u89e3\u51b3\u529e\u6cd5\u5206\u4eab"},"content":{"rendered":"<p>\u9519\u8bef\uff1aconfigure: error: libevent &gt;= 1.4.11 could not be found<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install libevent libevent-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: Please reinstall the mysql distributio<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install mysql-devel<\/p>\n<p>\u9519\u8bef\uff1amake: *** [sapi\/fpm\/php-fpm] error 1<\/p>\n<p>\u89e3\u51b3\uff1a\u7528make ZEND_EXTRA_LIBS=&#8217;-liconv&#8217;\u7f16\u8bd1<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: XML configuration could not be found<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install libxml2 libxml2-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: No curses\/termcap library found<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install ncurses ncurses-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: xml2-config not found<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install libxml2 libxml2-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: Cannot find OpenSSL&#8217;s &lt;evp.h&gt;<\/p>\n<p>\u89e3\u51b3\uff1ayum install openssl openssl-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: Please reinstall the libcurl distribution -easy.h should be in &lt;curl-dir&gt;\/include\/curl\/<\/p>\n<p>\u89e3\u51b3\uff1ayum install curl curl-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: Cannot find ldap.h<\/p>\n<p>\u89e3\u51b3\uff1ayum install openldap openldap-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: libjpeg.(a|so) not found<\/p>\n<p>\u89e3\u51b3\uff1ayum install libjpeglibjpeg -devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: libpng.(a|so) not found.<\/p>\n<p>\u89e3\u51b3\uff1ayum install libpnglibpng \u2013devel<\/p>\n<p>\u9519\u8bef\uff1aonfigure: error: freetype.h not found.<\/p>\n<p>\u89e3\u51b3\uff1ayum install freetype-devel<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: cannot find output from lex; giving up<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install flex<\/p>\n<p>\u9519\u8bef\uff1aconfigure: error: mod_deflate has been requested but can not be built due to prerequisite failures<\/p>\n<p>\u89e3\u51b3\uff1ayum -y install zlib-devel openssl-devel<\/p>\n<p>\u9519\u8bef\uff1aConfigure: error: Unable to locate gmp.h<\/p>\n<p>\u89e3\u51b3\uff1ayum install gmp-devel<\/p>\n<p>\u9519\u8bef\uff1aConfigure: error: Cannot find MySQL header files under \/usr.<\/p>\n<p>Note that the MySQL client library is not bundled anymore!<\/p>\n<p>\u89e3\u51b3\uff1ayum install mysql-devel<\/p>\n<p><strong>\u66f4\u591a\u7684\u8865\u5145\u5185\u5bb9\uff1a<\/p>\n<p><\/strong>\u5b89\u88c5php: .\/configure<br \/>\nconfigure: error: XML configuration could not be found<\/p>\n<p>yum -y install libxml2 libxml2-devel<\/p>\n<p>Cannot find OpenSSL&#8217;s &lt;evp.h&gt;<br \/>\nyum install openssl openssl-devel<\/p>\n<p>1) Configure: error: xml2-config not found. Please check your libxml2 installation.<br \/>\n#yum install libxml2 libxml2-devel (For RedHat &amp; Fedora)<br \/>\n# aptitude install libxml2-dev (For Ubuntu)<\/p>\n<p>2) Checking for pkg-config\u2026 \/usr\/bin\/pkg-config<br \/>\nconfigure: error: Cannot find OpenSSL&#8217;s &lt;evp.h&gt;<br \/>\n#yum install openssl openssl-devel<\/p>\n<p>3) Configure: error: Please reinstall the BZip2 distribution<br \/>\n# yum install bzip2 bzip2-devel<\/p>\n<p>4) Configure: error: Please reinstall the libcurl distribution &#8211;<br \/>\neasy.h should be in &lt;curl-dir&gt;\/include\/curl\/<br \/>\n# yum install curl curl-devel (For RedHat &amp; Fedora)<br \/>\n# install libcurl4-gnutls-dev (For Ubuntu)<\/p>\n<p>5) Configure: error: libjpeg.(also) not found.<br \/>\n# yum install libjpeg libjpeg-devel<\/p>\n<p>6) Configure: error: libpng.(also) not found.<br \/>\n# yum install libpng libpng-devel<\/p>\n<p>7) Configure: error: freetype.h not found.<br \/>\n#yum install freetype-devel<\/p>\n<p>8) Configure: error: Unable to locate gmp.h<br \/>\n# yum install gmp-devel<\/p>\n<p>9) Configure: error: Cannot find MySQL header files under \/usr.<br \/>\nNote that the MySQL client library is not bundled anymore!<br \/>\n# yum install mysql-devel (For RedHat &amp; Fedora)<br \/>\n# apt-get install libmysql++-dev (For Ubuntu)<\/p>\n<p>10) Configure: error: Please reinstall the ncurses distribution<br \/>\n# yum install ncurses ncurses-devel<\/p>\n<p>11) Checking for unixODBC support\u2026 configure: error: ODBC header file \u2018\/usr\/include\/sqlext.h&#8217; not found!<br \/>\n# yum install unixODBC-devel<\/p>\n<p>12) Configure: error: Cannot find pspell<br \/>\n# yum install pspell-devel<\/p>\n<p>13) configure: error: mcrypt.h not found. Please reinstall libmcrypt.<br \/>\n# yum install libmcrypt libmcrypt-devel (For RedHat &amp; Fedora)<br \/>\n# apt-get install libmcrypt-dev<\/p>\n<p>14) Configure: error: snmp.h not found. Check your SNMP installation.<br \/>\n# yum install net-snmp net-snmp-devel<\/p>\n<p>15)<br \/>\n\/usr\/bin\/ld: cannot find -lltdl<br \/>\ncollect2: ld returned 1 exit status<br \/>\nmake: *** [sapi\/cgi\/php-cgi] Error 1<br \/>\n# yum install libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64<\/p>\n<p>16\uff09<br \/>\n\u4e3aphp\u7f16\u8bd1xcache\u6a21\u5757\u7684\u65f6\u5019\uff0c\u9700\u8981\u8fd0\u884cphpize<br \/>\n\u5f97\u5230\u4e86\u4e00\u4e2a\u9519\u8bef<br \/>\n#\/usr\/local\/php\/bin\/phpize<br \/>\nConfiguring for:<br \/>\nPHP Api Version: 20041225<br \/>\nZend Module Api No: 20060613<br \/>\nZend Extension Api No: 220060519<br \/>\nCannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF<br \/>\nenvironment variable is set correctly and then rerun this script.<br \/>\n\u901a\u8fc7\u5b89\u88c5 autoconf \u53ef\u4ee5\u89e3\u51b3<br \/>\ncentos\u4e0b\u6267\u884c yum install autoconf \u5373\u53ef<br \/>\nUbuntu\u4e0b\u6267\u884c apt-get install autoconf \u5373\u53ef<br \/>\n17\uff09<br \/>\n# \/usr\/local\/php\/bin\/phpize<br \/>\nCannot find config.m4.<br \/>\nMake sure that you run &#8216;\/usr\/local\/php\/bin\/phpize&#8217; in the top level source directory of the module<br \/>\n\u4fee\u6539\u65b9\u6cd5\uff1a<br \/>\n[root@centos lnmp]# cd php-5.2.14ext\/<br \/>\n[root@centos ext]# .\/ext_skel &#8211;extname=my_module<br \/>\nCreating directory my_module<br \/>\nCreating basic files: config.m4 config.w32 .cvsignore my_module.c php_my_module.h CREDITS EXPERIMENTAL tests\/001.phpt my_module.php [done].<br \/>\nTo use your new extension, you will have to execute the following steps:<br \/>\n1. $ cd ..<br \/>\n2. $ vi ext\/my_module\/config.m4<br \/>\n3. $ .\/buildconf<br \/>\n4. $ .\/configure &#8211;[with|enable]-my_module<br \/>\n5. $ make<br \/>\n6. $ .\/php -f ext\/my_module\/my_module.php<br \/>\n7. $ vi ext\/my_module\/my_module.c<br \/>\n8. $ make<br \/>\nRepeat steps 3-6 until you are satisfied with ext\/my_module\/config.m4 and<br \/>\nstep 6 confirms that your module is compiled into PHP. Then, start writing<br \/>\ncode and repeat the last two steps as often as necessary.<br \/>\n[root@centos ext]# cd my_module\/<br \/>\n[root@centos my_module]# vim config.m4<br \/>\n\u6839\u636e\u4f60\u81ea\u5df1\u7684\u9009\u62e9\u5c06<br \/>\ndnl PHP_ARG_WITH(my_module, for my_module support,<br \/>\ndnl Make sure that the comment is aligned:<br \/>\ndnl [ &#8211;with-my_module Include my_module support])<br \/>\n\u4fee\u6539\u6210<br \/>\nPHP_ARG_WITH(my_module, for my_module support,<br \/>\nMake sure that the comment is aligned:<br \/>\n[ &#8211;with-my_module Include my_module support])<br \/>\n\u6216\u8005\u5c06<br \/>\ndnl PHP_ARG_ENABLE(my_module, whether to enable my_module support,<br \/>\ndnl Make sure that the comment is aligned:<br \/>\ndnl [ &#8211;enable-my_module Enable my_module support])<br \/>\n\u4fee\u6539\u6210<br \/>\nPHP_ARG_ENABLE(my_module, whether to enable my_module support,<br \/>\nMake sure that the comment is aligned:<br \/>\n[ &#8211;enable-my_module Enable my_module support])<br \/>\n[root@centos my_module]# vim my_module.c<br \/>\n\u5c06\u6587\u4ef6\u5176\u4e2d\u7684\u4e0b\u5217\u4ee3\u7801\u8fdb\u884c\u4fee\u6539<br \/>\n\/* Every user visible function must have an entry in my_module_functions[].<br \/>\n*\/<br \/>\nfunction_entry my_module_functions[] = {<br \/>\nPHP_FE(say_hello,\u3000\u3000\u3000 NULL)\u3000\/* ?\u6dfb\u52a0\u7740\u4e00\u884c\u4ee3\u7801 *\/<br \/>\nPHP_FE(confirm_my_module_compiled,\u3000\u3000\u3000NULL) \/* For testing, remove later. *\/<br \/>\n{NULL, NULL, NULL}\u3000\u3000\u3000\/* Must be the last line in my_module_functions[] *\/<br \/>\n};<br \/>\n\u5728\u6587\u4ef6\u7684\u6700\u540e\u6dfb\u52a0\u4e0b\u5217\u4ee3\u7801<br \/>\nPHP_FUNCTION(say_hello)<br \/>\n{<br \/>\nzend_printf(&#8220;hello sdomain!&#8221;);<br \/>\n}<br \/>\n\u518d\u4fee\u6539\uff1aphp_sdomain.h<br \/>\nvi php_sdomain.h<br \/>\n\u5728PHP_FUNCTION(confirm_my_module_compiled ); \/* For testing, remove later. *\/ \u8fd9\u884c\u7684\u4e0b\u9762\u6dfb\u52a0\u4e00\u884c\uff1a<br \/>\nPHP_FUNCTION(say_hello); \/* For testing, remove later. *\/<br \/>\n\u4fdd\u5b58\u6587\u4ef6\u9000\u51fa<br \/>\n\u7136\u540e\u6211\u4eec\u5c31\u53ef\u4ee5\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u4f7f\u7528\u4e0a\u9762\u7684\u547d\u4ee4\u4e86<br \/>\n\/usr\/local\/php\/bin\/phpize<br \/>\n\u6267\u884c\u4ee5\u540e\u4f1a\u770b\u5230\u4e0b\u9762\u7684<br \/>\n[root@ns sdomain]# \/usr\/local\/php\/bin\/phpize<br \/>\nConfiguring for:<br \/>\nPHP Api Version:\u3000\u3000\u3000\u3000 20020918<br \/>\nZend Module Api No:\u3000\u3000\u300020020429<br \/>\nZend Extension Api No:\u3000 20050606<br \/>\n[root@ns sdomain]#<br \/>\n\u7136\u540e\u6267\u884c.\/configure &#8211;with-php-config=\/usr\/local\/php\/bin\/php-config<br \/>\n\u7136\u540e\u6267\u884cmake<br \/>\nmake install<br \/>\n\u7136\u540e\u4ed6\u4f1a\u628a\u5bf9\u5e94\u7684so\u6587\u4ef6\u751f\u6210\u653e\u5230PHP\u5b89\u88c5\u76ee\u5f55\u4e0b\u9762\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u5e76\u63d0\u793a\u5728\u5728\u4ec0\u4e48\u5730\u65b9\uff0c\u7136\u540e\u518d\u628a\u91cc\u9762\u7684SO\u6587\u4ef6\u62f7\u5230\u4f60\u5b58\u653eSO\u6587\u4ef6\u7684\u5730\u65b9<br \/>\n\u5373\u4f60\u5728php.ini\u91cc\u9762\u7684extension_dir\u6240\u6307\u5b9a\u7684\u4f4d\u7f6e<br \/>\n\u6700\u540e\u4e00\u6b65\u662f\u4f60\u5728php.ini\u6587\u4ef6\u4e2d\u6253\u5f00\u8fd9\u4e2a\u6269\u5c55<br \/>\nextension=sdomain.so<br \/>\n\u7136\u540e<br \/>\n\u91cd\u65b0\u8d77\u52a8apache<\/p>\n<p>\u4ee5\u4e0a\u9519\u8bef\u90fd\u662f\u5728\u6574\u4e2a\u7f16\u8bd1\u5b89\u88c5\u9047\u5230\u7684\u95ee\u9898\uff0c\u7136\u540e\u7ed3\u5408\u7f51\u4e0a\u7684\u8d44\u6599\uff0c\u627e\u5230\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u603b\u7ed3\u5230\u8fd9\u4e2a\u5730\u65b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u5927\u5bb6\uff01<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/www.jb51.net\/article\/37487.htm<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9519\u8bef\uff1aconfigure: error: libevent &gt;= 1.4.11 could not be &#8230; <a title=\"php\u6e90\u4ee3\u7801\u5b89\u88c5\u5e38\u89c1\u9519\u8bef\u4e0e\u89e3\u51b3\u529e\u6cd5\u5206\u4eab\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/php%e6%ba%90%e4%bb%a3%e7%a0%81%e5%ae%89%e8%a3%85%e5%b8%b8%e8%a7%81%e9%94%99%e8%af%af%e4%b8%8e%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%e5%88%86%e4%ba%ab\/\" aria-label=\"\u9605\u8bfb php\u6e90\u4ee3\u7801\u5b89\u88c5\u5e38\u89c1\u9519\u8bef\u4e0e\u89e3\u51b3\u529e\u6cd5\u5206\u4eab\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,5],"tags":[530],"class_list":["post-1668","post","type-post","status-publish","format-standard","hentry","category-php","category-jishu","tag-php"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=1668"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1668\/revisions"}],"predecessor-version":[{"id":1669,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1668\/revisions\/1669"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=1668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=1668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=1668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}