Home>Article>Backend Development> How to compile PHP 8.0 to MxSrvs tool on Mac

How to compile PHP 8.0 to MxSrvs tool on Mac

谨言慎行
谨言慎行 Original
2022-02-21 23:54:44 3137browse

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
下载PHP 8.0.16 版本
Go to/Applications/MxSrvs/binunder the main program path of MxSrvs, and create aphp_8.0.16file 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 thebinfolder
MxSrvs 主程序目录

##2. Open Finder-> Applications-> Search on the right for

MxSrvs-> Double-click to enterMxSrvs-> Double-click to enter thebinfolder
How to compile PHP 8.0 to MxSrvs tool on Mac

Compile starts

Unzip the downloaded file , get the [php-8.0.16] folder


How to compile PHP 8.0 to MxSrvs tool on MacCompilation 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

When the compilation is completed, you need to enter the (computer) password twice during compilation, because

sudoGenerally, during installation, you will not encounter too many missing components. If something is missing, basically just install whatever is missing

brew install xxxx

and then compile again.

Adapting MxSrvs

We restart the MxSrvs tool. At this time, you can see the PHP version we edited, switch to

8.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...

The first step is to replace all the folder names configured during compilation

php_8.0.16withphp, because MxSrvs will change the current switched version directory tophpwhen you switch the PHP version.

I used

VScode, dragged the folder to the editor, and then searched and replaced globally.

The second step is to copy the files

php-fpm.conf.defaultin the/Applications/MxSrvs/bin/php/etcdirectory to Rename the current directory tophp-fpm.conf, andwww.conf under/Applications/MxSrvs/bin/php/etc/php-fpm.d. defaultCopy to the current directory and rename it towww.conf

The third step is also a more important step. We need to edit the configuration file of the PHP version

/ Applications/MxSrvs/bin/php/etc/php.iniCompare line by line with the versionpph.iniprovided by MxSrvs, and then modify it to the corresponding configuration.

At this time, it can basically be said that all the work has been done and you can enjoy the results.


最终编译 PHP 8.0 适配 MxSrvs 完成

The above is the detailed content of How to compile PHP 8.0 to MxSrvs tool on Mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn