Open ticariofis opened 3 years ago
changed 66 to 25
if [ -z "$NGX_PHP_LIBS" ]; then
PHP_VERSION="`$PHP_CONFIG --version`"
# if [ ${PHP_VERSION:0:1} -ge "0" ]; then
# PHP_MAJOR_VERSION=""
# else
# PHP_MAJOR_VERSION=${PHP_VERSION:0:1}
PHP_MAJOR_VERSION="7.4.25"
NGX_PHP_LIBS="`$PHP_CONFIG --ldflags` `$PHP_CONFIG --libs` -L$PHP_LIB -lphp$PHP_MAJOR_VERSION "
fi
/root/ngx_php7/src/php/impl/php_ngx_cookie.c:147: undefined reference to
zend_parse_parameters'
collect2: error: ld returned 1 exit status
make[1]: [objs/Makefile:283: objs/nginx] Error 1
make[1]: Leaving directory '/root/nginx-1.18.0'
make: [Makefile:8: build] Error 2`
I got error again.
make a bash file for easy installation.
This is the error I get from docker.
Executing busybox-1.32.1-r6.trigger
OK: 336 MiB in 98 packages
./configure: error: invalid option "-fomit-frame-pointer"
The command '/bin/sh -c apk --no-cache add curl gcc g++ make musl-dev linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev openssl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev libedit-dev ncurses-dev php7-dev php7-embed argon2-dev && NGINX_VERSION=$(nginx -v 2>&1 | sed 's/^[^0-9]*//') && curl -sL -o nginx-${NGINX_VERSION}.tar.gz http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && tar -xf nginx-${NGINX_VERSION}.tar.gz && cd nginx-${NGINX_VERSION} && ./configure $(nginx -V 2>&1 | tail -1 | sed -e 's/configure arguments://' -e 's| --add-dynamic-module=[^ ]*||g') --with-ld-opt="-Wl,-rpath,${PHP_LIB}" --add-dynamic-module=../third_party/ngx_devel_kit --add-dynamic-module=.. && make && mkdir -p /usr/lib/nginx/modules && cp objs/ndk_http_module.so /usr/lib/nginx/modules && cp objs/ngx_http_php_module.so /usr/lib/nginx/modules' returned a non-zero code: 1
Do you have installed php7.4-dev
and libphp7.4-embed
?
of course [PHP Modules] calendar Core ctype date exif FFI fileinfo filter ftp gettext hash iconv json libxml mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer Zend OPcache zlib
[Zend Modules] Zend OPcache
And here an example with php8.0
that I use in the benchmarks:
https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/php-ngx/php-ngx-mysql.dockerfile
nano Dockerfile and paste all.
and use docker build -t nginx-php7 . ?
my project using php7.4
The process is the same for php7 or php8
my project is using php 7.4.
should i write it like this?
I can use it if you explain step by step.
I'm trying right now.
If you have installed php7.4
you only need to compile the php_ngx
with the same version of your nginx.
Which version of nginx do you have ?
im using this commands
`apt-get update -yqq && apt-get install -yqq software-properties-common LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php apt-get update -yqq apt-get install -yqq wget git unzip libxml2-dev cmake make systemtap-sdt-dev \ zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \ php7.4-cli php7.4-dev libphp7.4-embed php7.4-mysql
git clone https://github.com/rryqszq4/ngx_php7.git
wget 'http://nginx.org/download/nginx-1.18.0.tar.gz' tar -zxvf nginx-1.18.0.tar.gz cd nginx-1.18.0
export PHP_LIB=/usr/lib
./configure --user=www --group=www \ --prefix=/path/to/nginx \ --with-ld-opt="-Wl,-rpath,$PHP_LIB" \ --add-module=/path/to/ngx_php7/third_party/ngx_devel_kit \ --add-module=/path/to/ngx_php7 make && make install`
this page -> https://github.com/rryqszq4/ngx_php7
But which version is your Nginx? You need to compile using the same version.
nginx -v
not compile
/root/ngx_php7/src/php/impl/php_ngx_cookie.c:147: undefined reference to zend_parse_parameters' collect2: error: ld returned 1 exit status make[1]: [objs/Makefile:283: objs/nginx] Error 1 make[1]: Leaving directory '/root/nginx-1.18.0' make: [Makefile:8: build] Error 2`
I got error again.
make a bash file for easy installation.
Removing intermediate container 1acc6583748f ---> 94b853d6978e Step 9/12 : RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && tar -zxf nginx-${NGINX_VERSION}.tar.gz && cd nginx-${NGINX_VERSION} && export PHP_LIB=/usr/lib && bash ./configure --user=www --group=www --prefix=/nginx --with-ld-opt="-Wl,-rpath,$PHP_LIB" --add-module=/ngx_php7/third_party/ngx_devel_kit --add-module=/ngx_php7 > /dev/null && make > /dev/null && make install > /dev/null ---> Running in 5bd20e49ef5e Removing intermediate container 5bd20e49ef5e ---> 0250a83a99d5 Step 10/12 : RUN export WORKERS=$(( 4 $(nproc) )) && sed -i "s/worker_processes auto/worker_processes $WORKERS/g" /deploy/nginx.conf ---> Running in 86b7e54485ba sed: can't read /deploy/nginx.conf: No such file or directory The command '/bin/sh -c export WORKERS=$(( 4 $(nproc) )) && sed -i "s/worker_processes auto/worker_processes $WORKERS/g" /deploy/nginx.conf' returned a non-zero code: 2
docker return this message
yes because that line is specific for the benchmark.
but is the same you need to have a config for nginx in some place.
Create a deploy/nginx.conf
Or comment that line and in the last one remove -c /deploy/nginx.conf
And remove all the > /dev/null
, this is for don't show any output.
thank u..
you say super. that you should do this. You may be doing these things quickly. I'm not that expert. Maybe I can't meet the requirements. If someone can explain properly step by step I will use it in my project. or I'll get into trouble called lua. I am using ubuntu 20. I couldn't install what I did. never finished. I tried with docker and it didn't work. I tried to install it manually, nginx couldn't finish it. Isn't there a properly installed version of this? Not everyone is an nginx expert. cannot complete them.
But if arrive to that line, 10/12 , is that compiled OK.
this true, please control -->
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ apt-get install -yqq wget git unzip libxml2-dev cmake make systemtap-sdt-dev \ zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \ php8.0-cli php8.0-dev libphp8.0-embed php8.0-mysql nginx
ADD ./ ./
ENV NGINX_VERSION 1.21.3
RUN git clone -b v0.0.25 --single-branch --depth 1 https://github.com/rryqszq4/ngx_php7.git
RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \ tar -zxf nginx-${NGINX_VERSION}.tar.gz && \ cd nginx-${NGINX_VERSION} && \ export PHP_LIB=/usr/lib && \ bash ./configure --user=www --group=www \ --prefix=/nginx \ --with-ld-opt="-Wl,-rpath,$PHP_LIB" \ --add-module=/ngx_php7/third_party/ngx_devel_kit \ --add-module=/ngx_php7 && \ make > /dev/null && make install
RUN export WORKERS=$(( 4 * $(nproc) )) && \ sed -i "s/worker_processes auto/worker_processes $WORKERS/g" /deploy/nginx.conf
EXPOSE 8080
CMD /nginx/sbin/nginx -c /deploy/nginx.conf
I deleted all the images. I will start over. can you give me the correct docker file for 7.4.
I'm glad someone answered. My joy is over early. We're not going to launch rockets into space. We will install the plugin. it shouldn't be this hard. the vast majority of developers won't be able to do this. thank you again. Good luck.
true file ->
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq wget git unzip libxml2-dev cmake make systemtap-sdt-dev \
zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \
php8.0-cli php8.0-dev libphp8.0-embed php8.0-mysql nginx > /dev/null
ADD ./ ./
ENV NGINX_VERSION 1.21.3
RUN git clone -b v0.0.25 --single-branch --depth 1 https://github.com/rryqszq4/ngx_php7.git > /dev/null
RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
cd nginx-${NGINX_VERSION} && \
export PHP_LIB=/usr/lib && \
bash ./configure --user=www --group=www \
--prefix=/nginx \
--with-ld-opt="-Wl,-rpath,$PHP_LIB" \
--add-module=/ngx_php7/third_party/ngx_devel_kit \
--add-module=/ngx_php7 > /dev/null && \
make > /dev/null && make install > /dev/null
RUN export WORKERS=$(( 4 * $(nproc) )) && \
sed -i "s/worker_processes auto/worker_processes $WORKERS/g" /deploy/nginx.conf
EXPOSE 8080
CMD /nginx/sbin/nginx -c /deploy/nginx.conf
Removing intermediate container ccf12ba59785 ---> a465e060e2e6 Step 9/12 : RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && tar -zxf nginx-${NGINX_VERSION}.tar.gz && cd nginx-${NGINX_VERSION} && export PHP_LIB=/usr/lib && bash ./configure --user=www --group=www --prefix=/nginx --with-ld-opt="-Wl,-rpath,$PHP_LIB" --add-module=/ngx_php7/third_party/ngx_devel_kit --add-module=/ngx_php7 > /dev/null && make > /dev/null && make install > /dev/null ---> Running in 245cc6333bfc Removing intermediate container 245cc6333bfc ---> 6b3c56ed06ad Step 10/12 : RUN export WORKERS=$(( 4 * $(nproc) )) && sed -i "s/worker_processes auto/worker_processes $WORKERS/g" /deploy/nginx.conf ---> Running in 1862902787e8 Removing intermediate container 1862902787e8 ---> da204ae320a0 Step 11/12 : EXPOSE 8080 ---> Running in 97107eccebdd Removing intermediate container 97107eccebdd ---> 7e2c40c48375 Step 12/12 : CMD /nginx/sbin/nginx -c /deploy/nginx.conf ---> Running in 6bb46c806d0b Removing intermediate container 6bb46c806d0b ---> 8ded704063da Successfully built 8ded704063da Successfully tagged nginx-php7:latest
@ticariofis I have fixed it in this PR. https://github.com/rryqszq4/ngx_php7/pull/134
You can use PR as a workaround before it is merged.
./configure: 68: /root/ngx_php7/config: Bad substitution
if [ ${PHP_VERSION:0:1} -ge "7" ]; then
hello I'm using ubuntu 20
PHP 7.4.25 (cli) (built: Oct 22 2021 12:34:33) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies
I couldn't get it to work. I also tried docker. It did not happen. I couldn't get past this error.
Is there a detailed source for installation? step by step.
thanks..