mac安装php
<h1>一、安装php</h1><div class="cnblogs_code">
<pre>brew reinstall php</pre>
</div>
<p> </p>
<p>安装完成配置:</p>
<p>==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/php-8.0.11_<br>Already downloaded: /Users/huangdan07/Library/Caches/Homebrew/downloads/5f7fe12c310bba3fb550de97deff649d509fd63803b180f48fa768ca94e41d71--php-8.0.11_1.arm64_big_sur.bottle.tar.gz<br>==> Reinstalling php<br>==> Pouring php-8.0.11_1.arm64_big_sur.bottle.tar.gz<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set php_ini /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set php_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set doc_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set ext_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set bin_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set data_dir /opt/homebrew<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set cfg_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set www_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set man_dir /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set test_dir /opt/homebrew<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear config-set php_bin /opt/homebrew/<br>==> /opt/homebrew/Cellar/php/8.0.11_1/bin/pear update-channels<br>==> Caveats<br>To enable PHP in Apache add the following to httpd.conf and restart Apache:<br>LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so</p>
<p><FilesMatch \.php$><br>SetHandler application/x-httpd-php<br></FilesMatch></p>
<p>Finally, check DirectoryIndex includes index.php<br>DirectoryIndex index.php index.html</p>
<p>The php.ini and php-fpm.ini file can be found in:<br>/opt/homebrew/etc/php/8.0/</p>
<p>To start php:<br>brew services start php<br>Or, if you don't want/need a background service you can just run:<br>/opt/homebrew/opt/php/sbin/php-fpm --nodaemonize<br>==> Summary<br>🍺 <span style="color: rgba(255, 0, 0, 1)">/opt/homebrew/Cellar/php/8.0.11_1</span>: 500 files, 78.0MB</p>
<p> </p>
<p> </p>
<p>Build process completed successfully<br>Installing '/opt/homebrew/Cellar/php/8.0.11_1/pecl/20200930/xdebug.so'<br>install ok: channel://pecl.php.net/xdebug-3.1.1<br>Extension xdebug enabled in php.ini</p>
<p> </p>
<p>重定向到:/opt/homebrew/lib/php/pecl/20200930/xdebug.so</p>
<p> </p>
<h1>二、运行php</h1>
<div class="cnblogs_code">
<pre>cd /opt/homebrew/Cellar/php/8.0.11_1/bin</pre>
</div>
<div class="cnblogs_code">
<pre>php -f /opt/homebrew/var/www/index.php</pre>
</div>
<p> </p>
<p> </p>
<div class="clear"> </div>
<div id="blog_post_info_block"> </div><br><br>
来源:https://www.cnblogs.com/hd92/p/15419942.html
頁:
[1]