I think I am a decent PHP programmer, but I am lost when it comes to devops, C,
Makefiles and compiling stuff. I just want to write brew upgrade php and
be happy. If that doesn’t work I have to google each small step to fix the issue.
I love writing bash for example, but I need to google the syntax of an if-statement
for every bash script I write.
The RC for PHP 7.4.2 just came out this week. I decided to test it out. I downloaded
the release from the website http://qa.php.net/, unzipped them. I carefully followed
some guide saying:
If course I ran in to issues like:
Since OSX dont follow standard paths where libraries live you need to provide their
locations to the ./configure command. In OSX versions before Catalina (10.15)
you could do some trick,
but that does not work any more.
And in PHP versions before 7.4 you could use options like --with-libxml-dir,
but that has been removed in favor of
What you should do
So every time it complains, ie for libxml2, you should update the PGK_CONFIG_PATH
environment variable. The value depends on the path to the library.
To find the path, lets run brew info:
From the output we see that libxml2 lives in /usr/local/Cellar/libxml2/2.9.9_2.
That means pkgconfig lives in this folder:
For my machine, I had to run the following three commands to successfully compile
I struggled for hours to compile PHP 7.4. My main mistake was that I didn’t read
the output of the ./configure command. Please please please, make sure to read
at least the last 20 lines.