{"id":85624,"date":"2023-12-20T05:47:03","date_gmt":"2023-12-19T21:47:03","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=85624"},"modified":"2023-12-20T05:47:03","modified_gmt":"2023-12-19T21:47:03","slug":"httpd-make-php","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/httpd-make-php.html","title":{"rendered":"\u4e3ahttpd2.4.x\u7f16\u8bd1\u5b89\u88c5php\u6a21\u5757"},"content":{"rendered":"
\u524d\u9762\u6211\u4eec\u5df2\u7ecf\u7f16\u8bd1\u5b89\u88c5\u4e86httpd\u670d\u52a1\uff0c\u90a3\u4e48\u73b0\u5728\uff0c\u6211\u4eec\u5c31\u6765\u7f16\u8bd1php\u5427~~<\/p>\n
PHP\uff08\u5916\u6587\u540d:PHP: Hypertext Preprocessor\uff0c\u4e2d\u6587\u540d\uff1a\u201c\u8d85\u6587\u672c\u9884\u5904\u7406\u5668\u201d\uff09\u662f\u4e00\u79cd\u901a\u7528\u5f00\u6e90\u811a\u672c\u8bed\u8a00\u3002\u8bed\u6cd5\u5438\u6536\u4e86C\u8bed\u8a00\u3001Java\u548cPerl\u7684\u7279\u70b9\uff0c\u5229\u4e8e\u5b66\u4e60\uff0c\u4f7f\u7528\u5e7f\u6cdb\uff0c\u4e3b\u8981\u9002\u7528\u4e8eWeb\u5f00\u53d1\u9886\u57df\u3002<\/p>\n
\u8ddfweb\u670d\u52a1\u7684\u7ed3\u5408\u4e3b\u8981\u53ef\u4ee5\u4f7f\u7528CGI\u3001apache module\u3001fcgi\u7684\u65b9\u5f0f\u7ed3\u5408\uff0cCGI\u56e0\u4e3a\u6548\u7387\u95ee\u9898\u5df2\u7ecf\u7b97\u662f\u88ab\u6dd8\u6c70\u7684\u6280\u672f\u4e86\uff0c\u800c\u5c06php\u4f5c\u4e3aapache module\u7684\u8bdd\uff0c\u914d\u7f6e\u76f8\u5bf9\u7b80\u5355\uff0c\u4f46\u6548\u7387\u4e0d\u662f\u6700\u597d\u7684\uff0c\u56e0\u4e3aapache\u518d\u52a0\u8f7d\u9759\u6001\u8d44\u6e90\u7684\u65f6\u5019\u4e5f\u4f1a\u52a0\u8f7dphp-module\uff0c\u800c\u5c06php\u4ee5fcgi\u7684\u65b9\u5f0f\u8c8c\u4f3c\u6210\u4e3a\u4e86\u73b0\u5728\u7684\u4e3b\u6d41\u9009\u62e9\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u8bb0\u5f55\u4e0b\u7f16\u8bd1Php\u4f5c\u4e3aapache\u6a21\u5757\u7684\u6b65\u9aa4\u3002<\/p>\n
\u8bbf\u95eephp\u7684\u5b98\u65b9\u7f51\u7ad9<\/a>\uff0c\u53ef\u4ee5\u770b\u5230\u73b0\u5728\u4e3b\u8981\u6709\u4e09\u4e2a\u5206\u652f5.6.x 7.0.x 7.1.x\uff0c\u6211\u9009\u62e95.6.x\u6765\u7f16\u8bd1\u3002<\/p>\n \u5148\u5b89\u88c5\u4e24\u4e2a\u5305 yum install libxml2-devel openssl-devel \uff0c\u8fd9\u4e24\u4e2a\u5305\u5728\u540e\u9762\u7f16\u8bd1\u4f1a\u88ab\u4f9d\u8d56\u3002<\/p>\n \u5173\u4e8e\u8fd9\u4e9b\u9009\u9879\u53ef\u4ee5\u6267\u884c.\/configure --help\u67e5\u770b\u5e2e\u52a9\uff0c\u56e0\u4e3a\u5c0f\u5f1f\u662f\u4e2a\u83dc\u9e1f\uff0c\u6240\u4ee5\u5f88\u591a\u4e1c\u897f\u6ca1\u542f\u7528\u62b1\u6b49 \u6ce8\u610f\uff1a\u5982\u9047\u4e0b\u9762\u62a5\u9519\u8bf7\u6267\u884cmake clean \u540e\u518d\u7f16\u8bd1\u5373\u53ef<\/strong><\/p>\n 1.\u68c0\u67e5httpd.conf\u4e2d\u662f\u5426\u52a0\u8f7d\u4e86\u76f8\u5e94\u6a21\u5757\uff0c\u8fd9\u91cc\u7a0b\u5e8f\u5e94\u8be5\u5e2e\u6211\u4eec\u52a0\u8fc7\u4e86<\/p>\n 2.\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\u5230httpd.conf<\/p>\n 3.\u91cd\u542fhttpd\u670d\u52a1<\/p>\n 1.\u5728web\u76ee\u5f55\u4e0b\u521b\u5efatest.php\u6587\u4ef6<\/p>\n 2.\u8bbf\u95ee http:\/\/IP\/tset.php php\u6e90\u7801\u5305\u4e2d\u6709\u4e00\u4e2aext\u76ee\u5f55\uff0c\u8fd9\u91cc\u5b58\u653e\u4e86\u6240\u6709\u5f53\u524d\u7248\u672c\u53ef\u7528\u7684\u6269\u5c55\u6a21\u5757\uff0c\u5982\u679c\u5728\u7f16\u8bd1\u65f6\u6ca1\u6709\u4e3aphp\u542f\u7528\u67d0\u4e9b\u652f\u6301\uff0c\u53ef\u4ee5\u7f16\u8bd1\u6269\u5c55\u6a21\u5757\u6765\u989d\u5916\u6dfb\u52a0\u652f\u6301\u3002<\/p>\n \u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u63d0\u793a\u5373\u8bf4\u660e\u5b89\u88c5\u6210\u529f \u4fee\u6539php.ini \u5c06\u5176extension-dir\u4fee\u6539\u5230\u6211\u4eec\u5b89\u88c5\u7684\u8fd9\u4e2a\u76ee\u5f55<\/p>\n \u91cd\u542fhttpd<\/p>\n \u518d\u6b21\u8bbf\u95eephpinfo\u9875\u9762\uff0c\u770b\u5230\u5982\u4e0b\u56fe\u5373\u4e3a\u5b89\u88c5\u6210\u529f \u539f\u6587\u6765\u81ea\uff1ahttp:\/\/100ye.wang\/linux\/httpd-make-php.html<\/a><\/p>\n \r\ncd ~\r\nwget http:\/\/hk1.php.net\/distributions\/php-5.6.31.tar.gz\r\n<\/pre>\n
\r\ntar -xf php-5.6.31.tar.gz \r\ncd php-5.6.31\r\n.\/configure --prefix \/usr\/local\/php56 --with-apxs2=\/usr\/local\/httpd24\/bin\/apxs --with-config-file-path=\/etc\/ --with-config-file-scan-dir=\/etc\/php.d --with-libxml-dir --with-openssl --with-zlib --enable-mbstring --with-mysql\r\nmake -j 2 && make install\r\n<\/pre>\n
\n
\n\u6216\u8005\u4f60\u4e5f\u53ef\u4ee5\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u7684phpinfo()\u51fd\u6570\u4e2d\u83b7\u5f97\u7f16\u8bd1\u9009\u9879\uff0c\u5982\u4e0b\u56fe\u6240\u793a
\n<\/p>\nlibtool: link: `ext\/date\/php_date.lo' is not a valid libtool object<\/pre>\n
\r\ncp php.ini-development \/etc\/php.ini \/\/\u6b64\u6587\u4ef6\u5728\u6e90\u7801\u76ee\u5f55\u4e0b\r\nmkdir \/etc\/php.d\/\r\n<\/pre>\n
LoadModule php5_module modules\/libphp5.so<\/pre>\n
\r\n
\r\napachectl restart\r\n<\/pre>\n
\r\necho \"< ?php phpinfo() ?>\" > \/usr\/local\/httpd24\/htdocs\/\/test.php \/\/\u8fd9\u91cc\u586b\u76f8\u5e94\u7684web\u6839\u76ee\u5f55\u5373\u53ef\r\n<\/pre>\n
\n<\/p>\n\r\ncd \/root\/php-5.6.31\/ext\/mcrypt\r\nexport PATH=$PATH:\/usr\/local\/php56\/bin\/ \/\/\u8fd9\u91cc\u6211\u4e34\u65f6\u6539\u4e0bPATH\u73af\u5883\u53d8\u91cf\uff0c\u63a8\u8350\u52a0\u5165\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\r\nphpize \r\n.\/configure \r\nmake \r\nmake install\r\n<\/pre>\n
\nInstalling shared extensions: \/usr\/local\/php56\/lib\/php\/extensions\/no-debug-non-zts-20131226\/<\/p>\n\r\necho \"extension_dir = \\\"\/usr\/local\/php56\/lib\/php\/extensions\/no-debug-non-zts-20131226\/\\\"\" >> \/etc\/php.ini\r\necho \"extension=mcrypt.so\" >> \/etc\/php.ini\r\n<\/pre>\n
\r\napachectl restart\r\n<\/pre>\n
\n<\/p>\n\n