zephir: Cant find php.h where zephir build

I am a rookie in zephir and github My php release is 5.6.31 and zephir release is 0.10.0 I have install zephir success, but when I build, cli report ‘cant find php.h’ as below

sudo zephir build --with-php-config /usr/local/php/bin/php-config
Preparing for PHP compilation...
Preparing configuration file...
configure: error: Cannot find php-config. Please use --with-php-config=PATH
Compiling...
sh: 1: php-config: not found
kernel/operators.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/globals.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
In file included from ./php_utils.h:11:0,
                 from ./php_ext.h:4,
                 from kernel/fcall.h:24:
./kernel/globals.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/math.h:23:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/array.h:25:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
In file included from ./php_utils.h:11:0,
                 from ./php_ext.h:4,
                 from kernel/require.h:24:
./kernel/globals.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/iterator.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/memory.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/file.h:23:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/string.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/object.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/session.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/concat.h:5:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/exit.h:22:23: fatal error: Zend/zend.h: 没有那个文件或目录
compilation terminated.
kernel/variables.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/exception.h:24:23: fatal error: Zend/zend.h: 没有那个文件或目录
compilation terminated.
kernel/filter.h:23:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/time.h:20:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/main.h:23:34: fatal error: Zend/zend_interfaces.h: 没有那个文件或目录
compilation terminated.
kernel/debug.h:25:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
kernel/output.h:24:17: fatal error: php.h: 没有那个文件或目录
compilation terminated.
Installing...
[Zephir\Compiler\CompilerException]: Internal extension compilation failed. Check compile-errors.log for more information

at Library/Compiler.php(1217)

Stack trace:
#0 Library/Compiler.php(1292): Zephir\Compiler->install(Object(Zephir\Commands\CommandBuild), false)
#1 Library/Commands/CommandAbstract.php(144): Zephir\Compiler->build(Object(Zephir\Commands\CommandBuild))
#2 Library/Bootstrap.php(114): Zephir\Commands\CommandAbstract->execute(Object(Zephir\Config), Object(Zephir\Logger))
#3 compiler.php(17): Zephir\Bootstrap->boot()
#4 {main}

‘没有那个文件或目录’ mean ‘No such file or directory’ SO WHAT SHOULD I DO ??? (●’◡’●)ノ

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

You need to install php5-dev package. As you can see:

configure: error: Cannot find php-config. Please use --with-php-config=PATH
Compiling...
sh: 1: php-config: not found

The path you provided for php-config is wrong. Or well you missed = - sudo zephir build --with-php-config=/usr/local/php/bin/php-config

I have successfully installed in this way, using Pecl. Tested on Ubuntu 18.04

sudo apt-get update

Adding a repository sudo apt -y install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt -y install php7.4

sudo apt-get install php7.4 php7.4-bcmath php7.4-bz2 php7.4-common php7.4-curl php7.4-decimal php7.4-dev php7.4-json php7.4-intl php7.4-mbstring php7.4-mcrypt php7.4-mysql php7.4-opcache php7.4-pgsql php7.4-readline php7.4-sqlite3 php7.4-ssh2 php7.4-xml php7.4-xmlrpc php7.4-zip php7.4-yaml

sudo apt-get install php7.4-dev gcc make re2c autoconf automake git libpcre3-dev build-essential

sudo pecl channel-update pecl.php.net sudo pecl install zephir_parser

sudo nano /etc/php/7.4/cli/php.ini [Zephir Parser] extension=zephir_parser.so

php-m (zephir_parser) php -i | grep 'zephir' (zephir_parser enabled)

sudo apt-get install composer composer global require phalcon/zephir:0.16.0

composer -n config --global home Learn the path: /home/user/.config/composer nano ~/.bashrc export PATH=$PATH:/home/user/.config/composer/vendor/phalcon/zephir exit

zephir --version (0.16.0) zephir init myproject