Preface
First of all, I would like to thank the author of MxSrvs for making developing PHP on Mac so easy and less cumbersome.
There are two reasons why I compile manually:
1. After all, PHP 8.1 has been out for a long time now. If I don’t use version 8, it seems that there will be hundreds of millions of dollars?? It’s unreasonable
2. The highest compiled version provided by MxSrvs is only up to PHP 7.4.6
Because when I wanted to compile PHP 7.2 before, I sent an email to communicate with the author, and the author's reply was that normal compilation would be enough. Finally, I found that the author provided some useful subsequent version compilations, so I did not actually compile them locally and adapt to the Mxsrvs tool.
Start preparations
Download PHP 8.0
PHP official download
Go to /Applications/MxSrvs/bin
under the main program path of MxSrvs, and create a php_8.0.16
file according to the naming rules of Mxsrvs folder, used to store our compiled files
There are two ways to enter the directory:
1. Click the small icon in the status bar of the MxSrvs tool-> Locate the directory-> Main program directory-> Double-click Enter the bin
folder
MxSrvs -> Double-click to enter
MxSrvs -> Double-click to enter the
bin folder
Compile starts
Unzip the downloaded file , get the [php-8.0.16] folder
Compilation command:
./buildconf --force./configure --prefix=/Applications/MxSrvs/bin/php_8.0.16 \--with-config-file-path=/Applications/MxSrvs/bin/php_8.0.16/etc \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-pear \--with-zlib \--with-curl \--enable-mysqlnd \--enable-pdo \--enable-fpm \--enable-cli \--without-iconv sudo make && sudo make installsudo cp php.ini-development /Applications/MxSrvs/bin/php_8.0.16/etc/php.ini
sudoGenerally, during installation, you will not encounter too many missing components. If something is missing, basically just install whatever is missing
brew install xxxx
Adapting MxSrvs
We restart the MxSrvs tool. At this time, you can see the PHP version we edited, switch toThe first step is to replace all the folder names configured during compilation8.0.16
, you cannot start by clicking the start button at this time.
The startup error picture in the middle, because there is no screenshot, so...
php_8.0.16 with
php, because MxSrvs will change the current switched version directory to
php when you switch the PHP version.
I usedThe second step is to copy the filesVScode
, dragged the folder to the editor, and then searched and replaced globally.