Unable to use PHPIZE after update to MacOS Mojave

依然范特西╮ 提交于 2019-11-29 01:23:18

Potential better solution - force reinstall the header files. Fixed a ton of problems for me system wide.

Running the following command will reinstall the developer tools header files and should fix the issue.

$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

For some reason, I found Xcode command line tools was not installed completely on my Mac, Finally I solved this problem as follow:

 1. xcode-select --install
 2. cd /Library/Developer/CommandLineTools/Packages/ 
 3. open macOS_SDK_headers_for_macOS_10.14.pkg

Note: After doing step2, if there is no .pkg file in the dir. maybe this solution will not help you.

find the phpize and edit it,

~$ whereis phpize
phpize: /usr/local/bin/phpize
~$ vim  /usr/local/bin/phpize

in my phpize script it is like that

prefix='/usr/local/php7'   ## where you should edit
datarootdir='/usr/local/php7/php'
exec_prefix="`eval echo ${prefix}`"
phpdir="`eval echo ${exec_prefix}/lib/php`/build"
includedir="`eval echo ${prefix}/include`/php"
...

phpize_get_api_numbers()
{
  # extracting API NOs:
  PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
  ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
  ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
}

if you comfirm that you have the header file but the phpize script configure is wrong ,you can edit the row

prefix='/usr/local/php7'

and php.h is in

$ pwd
/usr/local/php7/include/php/main
$ ls  php.*
php.h

if not ,you can compile php by yourself

I had the same issue as described above, only I was trying to install xdebug on macOS Mojave.

I resolved the issue by executing:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!