{"id":734,"date":"2025-01-04T21:45:12","date_gmt":"2025-01-04T13:45:12","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=734"},"modified":"2025-01-04T21:45:12","modified_gmt":"2025-01-04T13:45:12","slug":"%e5%9c%a8php-7-0-%e4%b8%8a%e5%ae%89%e8%a3%85%e4%ba%86%e6%8f%92%e4%bb%b6%ef%bc%88%e6%89%a9%e5%b1%95%ef%bc%89%ef%bc%8c%e4%bd%86%e6%98%af-php-%e4%bb%8d%e7%84%b6%e6%98%be%e7%a4%ba%e6%9c%aa%e5%ae%89","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/01\/04\/%e5%9c%a8php-7-0-%e4%b8%8a%e5%ae%89%e8%a3%85%e4%ba%86%e6%8f%92%e4%bb%b6%ef%bc%88%e6%89%a9%e5%b1%95%ef%bc%89%ef%bc%8c%e4%bd%86%e6%98%af-php-%e4%bb%8d%e7%84%b6%e6%98%be%e7%a4%ba%e6%9c%aa%e5%ae%89\/","title":{"rendered":"\u5728PHP 7.0 \u4e0a\u5b89\u88c5\u4e86\u63d2\u4ef6\uff08\u6269\u5c55\uff09\uff0c\u4f46\u662f PHP \u4ecd\u7136\u663e\u793a\u672a\u5b89\u88c5\u662f\u4ec0\u4e48\u539f\u56e0\uff1f"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4f60\u5728 PHP 7.0 \u4e0a\u5b89\u88c5\u4e86\u63d2\u4ef6\uff08\u6269\u5c55\uff09\uff0c\u4f46\u662f PHP \u4ecd\u7136\u663e\u793a\u672a\u5b89\u88c5\uff0c\u53ef\u80fd\u5b58\u5728\u4ee5\u4e0b\u51e0\u79cd\u539f\u56e0\uff0c\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>PHP \u914d\u7f6e\u6587\u4ef6\u672a\u6b63\u786e\u52a0\u8f7d\u6269\u5c55<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1aPHP \u914d\u7f6e\u6587\u4ef6\uff08<code>php.ini<\/code>\uff09\u53ef\u80fd\u6ca1\u6709\u6b63\u786e\u52a0\u8f7d\u4f60\u5b89\u88c5\u7684\u63d2\u4ef6\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u68c0\u67e5 <code>php.ini<\/code> \u914d\u7f6e\u6587\u4ef6\uff0c\u786e\u8ba4\u63d2\u4ef6\u662f\u5426\u5df2\u88ab\u6b63\u786e\u52a0\u8f7d\u3002\u63d2\u4ef6\u7684\u52a0\u8f7d\u8bed\u53e5\u901a\u5e38\u662f\u7c7b\u4f3c <code>extension=plugin.so<\/code> \u6216 <code>extension=plugin.dll<\/code>\uff08\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u548c\u63d2\u4ef6\u4e0d\u540c\u800c\u4e0d\u540c\uff09\u3002<\/li>\n\n\n\n<li>\u786e\u4fdd\u4f60\u5728 <code>php.ini<\/code> \u6587\u4ef6\u4e2d\u6b63\u786e\u5730\u6dfb\u52a0\u4e86\u63d2\u4ef6\u7684\u52a0\u8f7d\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u4e86 <code>mysqli<\/code> \u6269\u5c55\uff0c\u5e94\u8be5\u5728 <code>php.ini<\/code> \u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<br><code>ini extension=mysqli.so # \u5bf9\u4e8e Linux \u7cfb\u7edf extension=php_mysqli.dll # \u5bf9\u4e8e Windows \u7cfb\u7edf<\/code><\/li>\n\n\n\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528 <code>php --ini<\/code> \u67e5\u770b PHP \u7684\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\uff0c\u786e\u4fdd\u4f60\u4fee\u6539\u7684\u662f\u6b63\u786e\u7684 <code>php.ini<\/code> \u6587\u4ef6\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>\u6ca1\u6709\u91cd\u65b0\u542f\u52a8 Web \u670d\u52a1\u5668<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1aPHP \u6269\u5c55\u9700\u8981\u91cd\u65b0\u52a0\u8f7d\u624d\u80fd\u751f\u6548\uff0c\u5982\u679c\u6ca1\u6709\u91cd\u542f Web \u670d\u52a1\u5668\uff0cPHP \u53ef\u80fd\u6ca1\u6709\u68c0\u6d4b\u5230\u65b0\u5b89\u88c5\u7684\u6269\u5c55\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u91cd\u542f Apache\u3001Nginx \u6216 PHP-FPM \u670d\u52a1\uff1a\n<ul class=\"wp-block-list\">\n<li>Apache\uff1a<code>sudo systemctl restart apache2<\/code>\uff08\u5bf9\u4e8e Debian\/Ubuntu\uff09\u6216 <code>sudo systemctl restart httpd<\/code>\uff08\u5bf9\u4e8e CentOS\/RHEL\uff09\u3002<\/li>\n\n\n\n<li>Nginx + PHP-FPM\uff1a<code>sudo systemctl restart php7.0-fpm<\/code>\uff08\u5bf9\u4e8e Debian\/Ubuntu\uff09\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u662f\u4f7f\u7528 PHP \u7684\u547d\u4ee4\u884c\u7248\u672c\uff0c\u91cd\u65b0\u542f\u52a8\u7ec8\u7aef\u5373\u53ef\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>\u63d2\u4ef6\u5b89\u88c5\u5931\u8d25<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1a\u63d2\u4ef6\u53ef\u80fd\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\uff0c\u6216\u8005\u6ca1\u6709\u6210\u529f\u5b89\u88c5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u67e5\u770b\u63d2\u4ef6\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u7684\u8f93\u51fa\uff0c\u786e\u8ba4\u662f\u5426\u6709\u9519\u8bef\u4fe1\u606f\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u5df2\u5b89\u88c5\u7684 PHP \u6269\u5c55\uff1a <code>php -m<\/code> \u8fd9\u5c06\u5217\u51fa\u6240\u6709\u5df2\u52a0\u8f7d\u7684 PHP \u6269\u5c55\uff0c\u68c0\u67e5\u4f60\u5b89\u88c5\u7684\u63d2\u4ef6\u662f\u5426\u5728\u5217\u51fa\u4e4b\u4e2d\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u6ca1\u6709\u627e\u5230\u6269\u5c55\uff0c\u5c1d\u8bd5\u91cd\u65b0\u5b89\u88c5\u5b83\uff1a\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <code>apt<\/code>\uff08Debian\/Ubuntu\uff09\u6216 <code>yum<\/code>\uff08CentOS\/RHEL\uff09\u7b49\u5305\u7ba1\u7406\u5de5\u5177\u91cd\u65b0\u5b89\u88c5\u63d2\u4ef6\u3002\u4f8b\u5982\uff0c\u5b89\u88c5 <code>mysqli<\/code> \u63d2\u4ef6\uff1a<br><code>bash sudo apt-get install php7.0-mysqli<\/code><br>\u6216\u8005\uff1a<br><code>bash sudo yum install php70-mysqli<\/code><\/li>\n\n\n\n<li>\u5982\u679c\u662f\u901a\u8fc7\u6e90\u7801\u5b89\u88c5\u63d2\u4ef6\uff0c\u786e\u4fdd\u6309\u7167\u6b63\u786e\u7684\u5b89\u88c5\u6b65\u9aa4\u6267\u884c\uff0c\u786e\u4fdd\u6ca1\u6709\u51fa\u9519\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>\u63d2\u4ef6\u7248\u672c\u4e0e PHP \u7248\u672c\u4e0d\u517c\u5bb9<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1a\u67d0\u4e9b PHP \u6269\u5c55\u53ef\u80fd\u4e0e PHP 7.0 \u4e0d\u517c\u5bb9\uff0c\u6216\u8005\u5b89\u88c5\u4e86\u9519\u8bef\u7684\u7248\u672c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u68c0\u67e5\u63d2\u4ef6\u7684\u7248\u672c\u662f\u5426\u4e0e PHP 7.0 \u517c\u5bb9\uff0c\u786e\u4fdd\u4e0b\u8f7d\u4e86\u6b63\u786e\u7248\u672c\u7684\u6269\u5c55\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u53ef\u80fd\uff0c\u66f4\u65b0 PHP \u5230\u652f\u6301\u7684\u7248\u672c\uff0c\u6216\u8005\u67e5\u627e\u9002\u7528\u4e8e PHP 7.0 \u7684\u63d2\u4ef6\u7248\u672c\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>\u63d2\u4ef6\u4f9d\u8d56\u7f3a\u5931<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1a\u67d0\u4e9b PHP \u6269\u5c55\u53ef\u80fd\u4f9d\u8d56\u4e8e\u7cfb\u7edf\u5e93\u6216\u5176\u4ed6 PHP \u6269\u5c55\uff0c\u5982\u679c\u8fd9\u4e9b\u4f9d\u8d56\u9879\u7f3a\u5931\uff0c\u6269\u5c55\u53ef\u80fd\u65e0\u6cd5\u52a0\u8f7d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u7f3a\u5c11\u4efb\u4f55\u4f9d\u8d56\uff1a<br><code>bash sudo apt-get install php7.0-common php7.0-cli php7.0-mbstring php7.0-curl<\/code><\/li>\n\n\n\n<li>\u786e\u4fdd\u6240\u6709\u4f9d\u8d56\u9879\u90fd\u5df2\u5b89\u88c5\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>Web \u670d\u52a1\u5668\u548c PHP \u4f7f\u7528\u7684\u4e0d\u540c PHP \u7248\u672c<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1a\u53ef\u80fd Web \u670d\u52a1\u5668\u4f7f\u7528\u7684\u662f\u4e0d\u540c\u7248\u672c\u7684 PHP\uff0c\u800c\u547d\u4ee4\u884c PHP \u4f7f\u7528\u7684\u662f\u4f60\u5b89\u88c5\u63d2\u4ef6\u7684 PHP \u7248\u672c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u786e\u4fdd Web \u670d\u52a1\u5668\u4f7f\u7528\u7684 PHP \u7248\u672c\u4e0e\u547d\u4ee4\u884c PHP \u7248\u672c\u76f8\u540c\u3002<\/li>\n\n\n\n<li>\u68c0\u67e5 Apache \u6216 Nginx \u914d\u7f6e\uff0c\u786e\u4fdd\u5b83\u4eec\u52a0\u8f7d\u7684\u662f\u6b63\u786e\u7684 PHP \u7248\u672c\u3002\u5982\u679c Web \u670d\u52a1\u5668\u4f7f\u7528 PHP-FPM\uff0c\u68c0\u67e5 <code>php-fpm<\/code> \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684 <code>php.ini<\/code> \u8def\u5f84\u3002<\/li>\n\n\n\n<li>\u4f60\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5 PHP \u7684\u7248\u672c\uff1a<br><code>bash php -v # \u67e5\u770b\u547d\u4ee4\u884c PHP \u7248\u672c apache2ctl -M | grep php # \u68c0\u67e5 Apache \u6a21\u5757\u4e2d\u52a0\u8f7d\u7684 PHP \u7248\u672c<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>\u63d2\u4ef6\u672a\u6b63\u786e\u5b89\u88c5\u5230\u6b63\u786e\u7684 PHP \u7248\u672c\u76ee\u5f55<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1a\u63d2\u4ef6\u53ef\u80fd\u88ab\u5b89\u88c5\u5230\u9519\u8bef\u7684 PHP \u7248\u672c\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u786e\u4fdd\u63d2\u4ef6\u5b89\u88c5\u5230\u6b63\u786e\u7684 PHP \u76ee\u5f55\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u627e\u5230\u5f53\u524d PHP \u914d\u7f6e\u7684\u6269\u5c55\u76ee\u5f55\uff1a<br><code>bash php -i | grep extension_dir<\/code><br>\u8fd9\u4f1a\u663e\u793a PHP \u6269\u5c55\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">8. <strong>\u68c0\u67e5\u65e5\u5fd7\u6587\u4ef6<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u539f\u56e0<\/strong>\uff1aPHP \u9519\u8bef\u65e5\u5fd7\u53ef\u80fd\u5305\u542b\u6709\u5173\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u68c0\u67e5 PHP \u9519\u8bef\u65e5\u5fd7\uff08\u901a\u5e38\u4f4d\u4e8e <code>\/var\/log\/php7.0-fpm.log<\/code> \u6216 <code>\/var\/log\/apache2\/error.log<\/code>\uff09\u3002<\/li>\n\n\n\n<li>\u67e5\u627e\u662f\u5426\u6709\u63d2\u4ef6\u52a0\u8f7d\u9519\u8bef\uff0c\u4f9d\u8d56\u95ee\u9898\u7b49\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u603b\u7ed3\uff1a<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u786e\u8ba4\u63d2\u4ef6\u5df2\u7ecf\u5728 <code>php.ini<\/code> \u6587\u4ef6\u4e2d\u6b63\u786e\u914d\u7f6e\u5e76\u52a0\u8f7d\u3002<\/li>\n\n\n\n<li>\u91cd\u542f Web \u670d\u52a1\u5668\u6216 PHP-FPM \u670d\u52a1\u3002<\/li>\n\n\n\n<li>\u68c0\u67e5\u63d2\u4ef6\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5e76\u786e\u4fdd\u63d2\u4ef6\u4e0e PHP \u7248\u672c\u517c\u5bb9\u3002<\/li>\n\n\n\n<li>\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4f9d\u8d56\u9879\u95ee\u9898\u6216\u7248\u672c\u51b2\u7a81\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <code>php -m<\/code> \u67e5\u770b\u5df2\u52a0\u8f7d\u7684\u6269\u5c55\uff0c\u786e\u8ba4\u63d2\u4ef6\u662f\u5426\u751f\u6548\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5e94\u8be5\u80fd\u89e3\u51b3 PHP \u6269\u5c55\u672a\u52a0\u8f7d\u7684\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u5728 PHP 7.0 \u4e0a\u5b89\u88c5\u4e86\u63d2\u4ef6\uff08\u6269\u5c55\uff09\uff0c\u4f46\u662f PHP \u4ecd\u7136\u663e\u793a\u672a\u5b89\u88c5\uff0c\u53ef\u80fd\u5b58\u5728\u4ee5\u4e0b\u51e0\u79cd\u539f\u56e0\uff0c\u5e76\u63d0\u4f9b\u89e3\u51b3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-734","post","type-post","status-publish","format-standard","hentry","category-php-"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=734"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/734\/revisions"}],"predecessor-version":[{"id":735,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/734\/revisions\/735"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}