Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant find php.h where zephir build #1653

Closed
huangjuyuan opened this issue May 30, 2018 · 18 comments
Closed

Cant find php.h where zephir build #1653

huangjuyuan opened this issue May 30, 2018 · 18 comments

Comments

@huangjuyuan
Copy link

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 ??? (●'◡'●)ノ

@Jurigag
Copy link
Contributor

Jurigag commented May 30, 2018

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

@huangjuyuan
Copy link
Author

Hi, thanks for you reply.
indeed,my php-config is in /usr/local/php/bin/php-config really, but use sudo zephir build --with-php-config=/usr/local/php/bin/php-config does not work.
But I when use ln

sudo ln -sf /usr/local/php/bin/php-config /usr/bin/php-config
sudo zephir build 

It compile success.

Preparing for PHP compilation...
Preparing configuration file...
Compiling...
Installing...
Extension installed!
Add extension=utils.so to your php.ini
Don't forget to restart your web server

thanks for your reply, and it solve my problem.
φ(≧ω≦*)♪

@sxin0
Copy link

sxin0 commented Dec 28, 2021

sudo /usr/local/bin/zephir build --with-php-config=/usr/local/php81/bin/php-config
The "--with-php-config" option does not exist.

ll /usr/local/php81/bin/
总用量 146M
-rwxr-xr-x 1 root root 847 12月 28 13:57 pear
-rwxr-xr-x 1 root root 868 12月 28 13:57 peardev
-rwxr-xr-x 1 root root 781 12月 28 13:57 pecl
lrwxrwxrwx 1 root root 9 12月 28 13:57 phar -> phar.phar
-rwxr-xr-x 1 root root 15K 12月 28 13:57 phar.phar
-rwxr-xr-x 1 root root 49M 12月 28 13:57 php
-rwxr-xr-x 1 root root 49M 12月 28 13:57 php-cgi
-rwxr-xr-x 1 root root 3.5K 12月 28 13:57 php-config
-rwxr-xr-x 1 root root 49M 12月 28 13:57 phpdbg
-rwxr-xr-x 1 root root 4.5K 12月 28 13:57 phpize

What is this? Zephir 0.15.2

@Jeckerson
Copy link
Member

@jiangshengxin php81 isn't fully supported yet, you can try to test from development branch

See more info here - #2255

@sxin0
Copy link

sxin0 commented Dec 29, 2021

@jiangshengxin php81 isn't fully supported yet, you can try to test from development branch

See more info here - #2255

php81 ok 了
image

@Syatsura
Copy link

Hello.
Thank you for your work.

Can you help me, please?

Ubuntu 20.04
PHP 7.4.3. Added to $PATH, used by the composer.
Zephir_parser 1.5.0. Compiled from source and enabled in PHP.
Zephir 0.14.0 (Also tried with other versions: 0.15.2, 0.16.0). Installed by composer global, added to $PATH.

  1. zephir init name
  2. a .zep file is placed
  3. zephir build
make: *** No rule to make target 'clean'.  Stop.
 Preparing for PHP compilation...
 Preparing configuration file...
sh: 1: ./configure: not found
 Compiling...
kernel/require.h:15:10: fatal error: php_ext.h: No such file or directory
   15 | #include "php_ext.h"
compilation terminated.
kernel/fcall.h:15:10: fatal error: php_ext.h: No such file or directory
   15 | #include "php_ext.h"
compilation terminated.
kernel/memory.h:17:10: fatal error: php_ext.h: No such file or directory
   17 | #include "php_ext.h"
compilation terminated.
 Installing...

 [ERROR] Internal extension compilation failed. Check compile-errors.log for more information.

compile-errors.log:

make: *** No targets specified and no makefile found.  Stop.
make: *** No targets specified and no makefile found.  Stop.

Which direction should I look?
Thank you in advance.

@Syatsura
Copy link

Syatsura commented Mar 31, 2022

You need to install php5-dev package

php5.6-dev is installed

@Syatsura
Copy link

The path you provided for php-config is wrong. Please use --with-php-config=PATH

The "--with-php-config" option does not exist

@Syatsura
Copy link

@Jurigag, can you help me, please?

@Jeckerson
Copy link
Member

@Syatsura Zephir 0.16 is only for PHP7.4 or above.

@Syatsura
Copy link

Syatsura commented Mar 31, 2022

Zephir 0.16 is only for PHP7.4 or above.

@Jeckerson, thank you for your reply. But I have PHP 7.4.3.

@Syatsura
Copy link

Ubuntu 20.04
PHP 7.4.3. Added to $PATH, used by the composer.
Zephir_parser 1.5.0. Compiled from source and enabled in PHP.
Zephir 0.14.0 (Also tried with other versions: 0.15.2, 0.16.0). Installed by composer global, added to $PATH.

@Syatsura
Copy link

Can you help me, please? Which direction should I look? Thank you in advance.

@Jurigag, @Jeckerson, @sergeyklay, @andresgutierrez, @ovr, @AlexNDRmac, @sjinks, @steffengy, @carvajaldiazeduar, @nkt, @dreamsxin, @gsouf

@sxin0
Copy link

sxin0 commented Mar 31, 2022

Can you help me, please? Which direction should I look? Thank you in advance.

@Jurigag, @Jeckerson, @sergeyklay, @andresgutierrez, @ovr, @AlexNDRmac, @sjinks, @steffengy, @carvajaldiazeduar, @nkt, @dreamsxin, @gsouf

Take a look at this
https://wiki.jsx6.com/#/PHP/Zephir-PHPC%E6%89%A9%E5%B1%95%E5%BC%80%E5%8F%91

@sxin0
Copy link

sxin0 commented Mar 31, 2022

Hello. Thank you for your work.

Can you help me, please?

Ubuntu 20.04 PHP 7.4.3. Added to $PATH, used by the composer. Zephir_parser 1.5.0. Compiled from source and enabled in PHP. Zephir 0.14.0 (Also tried with other versions: 0.15.2, 0.16.0). Installed by composer global, added to $PATH.

  1. zephir init name
  2. a .zep file is placed
  3. zephir build
make: *** No rule to make target 'clean'.  Stop.
 Preparing for PHP compilation...
 Preparing configuration file...
sh: 1: ./configure: not found
 Compiling...
kernel/require.h:15:10: fatal error: php_ext.h: No such file or directory
   15 | #include "php_ext.h"
compilation terminated.
kernel/fcall.h:15:10: fatal error: php_ext.h: No such file or directory
   15 | #include "php_ext.h"
compilation terminated.
kernel/memory.h:17:10: fatal error: php_ext.h: No such file or directory
   17 | #include "php_ext.h"
compilation terminated.
 Installing...

 [ERROR] Internal extension compilation failed. Check compile-errors.log for more information.

compile-errors.log:

make: *** No targets specified and no makefile found.  Stop.
make: *** No targets specified and no makefile found.  Stop.

Which direction should I look? Thank you in advance.

cd /data/install
wget https://www.php.net/distributions/php-8.1.1.tar.gz
tar -zxvf ./php-8.1.1.tar.gz

cd /usr/include/php
# Backing up original files
sudo mkdir .bak
sudo mv * ./.bak/
# Introducing new source code
sudo ln -s /data/install/php-8.1.1/ext /usr/include/php/
sudo ln -s /data/install/php-8.1.1/include /usr/include/php/
sudo ln -s /data/install/php-8.1.1/main /usr/include/php/
sudo ln -s /data/install/php-8.1.1/sapi /usr/include/php/
sudo ln -s /data/install/php-8.1.1/TSRM /usr/include/php/
sudo ln -s /data/install/php-8.1.1/Zend /usr/include/php/

# install zephir
git clone https://github.com/zephir-lang/zephir.git
composer install
chmod +x zephir
sudo ln -s /data/www/jsx/zephir/zephir /usr/local/bin/
✔> zephir
 _____              __    _
/__  /  ___  ____  / /_  (_)____
  / /  / _ \/ __ \/ __ \/ / ___/
 / /__/  __/ /_/ / / / / / /
/____/\___/ .___/_/ /_/_/_/
         /_/

@gsouf
Copy link
Contributor

gsouf commented Mar 31, 2022

@Syatsura please do not tag people like this who are not related to an issue, thanks :)

@Syatsura
Copy link

@jiangshengxin, thank you for your help :)

@Syatsura
Copy link

Syatsura commented Mar 31, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants