rryqszq4 / ngx-php

ngx-php - Embedded php7 or php8 scripting language for nginx module. Mainline development version of the ngx-php.
BSD 2-Clause "Simplified" License
586 stars 56 forks source link

Can not compile the module #1

Closed lykhouzov closed 6 years ago

lykhouzov commented 6 years ago

Hello, first of all thank you for doing this extension.

When i was trying to compile nginx with this extension i've got following exception:

/usr/lib/gcc/x86_64-alpine-linux-musl/6.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lphp7
collect2: error: ld returned 1 exit status

as i could find in config file there is an option with this -lphp7. Could you help me understand what that mean and what ld is trying to find?

PS: i am not strong with C at all so for me this is dark forest:)

rryqszq4 commented 6 years ago

@lykhouzov Sorry, im late. You need to recompile php7, following the method.

$ wget 'http://php.net/distributions/php-7.0.23.tar.gz'
$ tar xf php-7.0.23.tar.gz
$ cd php-7.0.23

$ ./configure --prefix=/path/to/php --enable-embed
$ make && make install

$ git clone https://github.com/rryqszq4/ngx_php7.git

$ wget 'http://nginx.org/download/nginx-1.6.3.tar.gz'
$ tar -zxvf nginx-1.6.3.tar.gz
$ cd nginx-1.6.3

$ export PHP_BIN=/path/to/php/bin
$ export PHP_INC=/path/to/php/include/php
$ export PHP_LIB=/path/to/php/lib

$ ./configure --user=www --group=www \
$             --prefix=/path/to/nginx \
$             --with-ld-opt="-Wl,-rpath,$PHP_LIB" \
$             --add-module=/path/to/ngx_php7

Or refer to another project https://github.com/rryqszq4/ngx_php. Hope to helping for you.

lykhouzov commented 6 years ago

Thank you. yes, i've tried you way and it's working. probably i was trying to do that with php from package of a dist.

also i've tried to compile it with php 7.1.10 and failed and opened new ticket about it...