Unable to use PHPIZE after update to MacOS Mojave

前端 未结 4 2140
醉酒成梦
醉酒成梦 2020-12-05 07:23

What i should do when i run PHPIZE and get the error below ? I already installed xcode command line tools.

grep: /usr/include/php/main/php.h: No         


        
相关标签:
4条回答
  • 2020-12-05 07:53

    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 /
    
    0 讨论(0)
  • 2020-12-05 07:56

    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.

    0 讨论(0)
  • 2020-12-05 07:56

    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

    0 讨论(0)
  • 2020-12-05 08:01

    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 /
    
    0 讨论(0)
提交回复
热议问题