Unable to use PHPIZE after update to MacOS Mojave

前端 未结 4 2184
醉酒成梦
醉酒成梦 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: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

提交回复
热议问题