I’m trying to use the builtin PHP in MacOS Catalina 10.15 by compiling the ZIP extension by myself.
In the new MacOS Catalina, the phpize
tool is no longer usable since inside it contains an invalid path to the PHP libraries. The volume /usr
is mounted read-only, making all the methods used in the past invalid.
I installed Xcode 11 from the AppStore.
Then I created another phpize
that references Xcode by copiyng it to my Desktop
cp /usr/bin/phpize ~/Desktop/
then opened it for edit with vim
vim ~/Desktop/phpize
and modified line 8 as follows
includedir = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php"
Then, downloaded php-7.3.8, the same PHP version built-in on MacOS Catalina 10.15.
After have unpacked the archive file in the Downloads folder, I opened the Terminal up to its folder
cd ~/Downloads/php-7.3.8/ext/zip
Once inside, launched the customized phpize in order to prepare the ZIP extension to configure
~/Desktop/phpize
The extension is now configurable. I launched configure with additional path to the required zlib
sudo ./configure --with-zlib-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/
The next step would be compile and install, but I’m still getting the error php.h file not found
make && make install
Maybe there’s still a wrong path somewhere...