rryqszq4 / ngx-php Goto Github PK
View Code? Open in Web Editor NEWngx-php - Embedded php7 or php8 scripting language for nginx module. Mainline development version of the ngx-php.
License: BSD 2-Clause "Simplified" License
ngx-php - Embedded php7 or php8 scripting language for nginx module. Mainline development version of the ngx-php.
License: BSD 2-Clause "Simplified" License
I receive errors when building from source. Please check the below infos.
[root@khotrungviet nginx-1.16.1]# make
make -f objs/Makefile
make[1]: Entering directory `/root/nginx-1.16.1'
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php7_zend_uthread.o \
/root/ngx_php7/src/ngx_http_php7_zend_uthread.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php8_zend_uthread.o \
/root/ngx_php7/src/ngx_http_php8_zend_uthread.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_zend_uthread.o \
/root/ngx_php7/src/ngx_http_php_zend_uthread.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_sleep.o \
/root/ngx_php7/src/ngx_http_php_sleep.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_socket.o \
/root/ngx_php7/src/ngx_http_php_socket.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_util.o \
/root/ngx_php7/src/ngx_http_php_util.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_variable.o \
/root/ngx_php7/src/ngx_http_php_variable.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_header.o \
/root/ngx_php7/src/ngx_http_php_header.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_http_php_keepalive.o \
/root/ngx_php7/src/ngx_http_php_keepalive.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_php_debug.o \
/root/ngx_php7/src/ngx_php_debug.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/src/ngx_php_conf_file.o \
/root/ngx_php7/src/ngx_php_conf_file.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx.o \
/root/ngx_php7/src/php/impl/php_ngx.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_core.o \
/root/ngx_php7/src/php/impl/php_ngx_core.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_log.o \
/root/ngx_php7/src/php/impl/php_ngx_log.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_request.o \
/root/ngx_php7/src/php/impl/php_ngx_request.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_socket.o \
/root/ngx_php7/src/php/impl/php_ngx_socket.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_var.o \
/root/ngx_php7/src/php/impl/php_ngx_var.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_sockets.o \
/root/ngx_php7/src/php/impl/php_ngx_sockets.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_header.o \
/root/ngx_php7/src/php/impl/php_ngx_header.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs -I src/http -I src/http/modules -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/src -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk \
-o objs/addon/impl/php_ngx_cookie.o \
/root/ngx_php7/src/php/impl/php_ngx_cookie.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /root/ngx_php7/third_party/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM -I /usr/include/php/Zend -I /usr/include/php/ext -I /usr/include/php/ext/date/lib -I /usr/include/php/sapi/embed -I objs \
-o objs/ngx_modules.o \
objs/ngx_modules.c
cc -o objs/nginx \
objs/src/core/nginx.o \
objs/src/core/ngx_log.o \
objs/src/core/ngx_palloc.o \
objs/src/core/ngx_array.o \
objs/src/core/ngx_list.o \
objs/src/core/ngx_hash.o \
objs/src/core/ngx_buf.o \
objs/src/core/ngx_queue.o \
objs/src/core/ngx_output_chain.o \
objs/src/core/ngx_string.o \
objs/src/core/ngx_parse.o \
objs/src/core/ngx_parse_time.o \
objs/src/core/ngx_inet.o \
objs/src/core/ngx_file.o \
objs/src/core/ngx_crc32.o \
objs/src/core/ngx_murmurhash.o \
objs/src/core/ngx_md5.o \
objs/src/core/ngx_sha1.o \
objs/src/core/ngx_rbtree.o \
objs/src/core/ngx_radix_tree.o \
objs/src/core/ngx_slab.o \
objs/src/core/ngx_times.o \
objs/src/core/ngx_shmtx.o \
objs/src/core/ngx_connection.o \
objs/src/core/ngx_cycle.o \
objs/src/core/ngx_spinlock.o \
objs/src/core/ngx_rwlock.o \
objs/src/core/ngx_cpuinfo.o \
objs/src/core/ngx_conf_file.o \
objs/src/core/ngx_module.o \
objs/src/core/ngx_resolver.o \
objs/src/core/ngx_open_file_cache.o \
objs/src/core/ngx_crypt.o \
objs/src/core/ngx_proxy_protocol.o \
objs/src/core/ngx_syslog.o \
objs/src/event/ngx_event.o \
objs/src/event/ngx_event_timer.o \
objs/src/event/ngx_event_posted.o \
objs/src/event/ngx_event_accept.o \
objs/src/event/ngx_event_udp.o \
objs/src/event/ngx_event_connect.o \
objs/src/event/ngx_event_pipe.o \
objs/src/os/unix/ngx_time.o \
objs/src/os/unix/ngx_errno.o \
objs/src/os/unix/ngx_alloc.o \
objs/src/os/unix/ngx_files.o \
objs/src/os/unix/ngx_socket.o \
objs/src/os/unix/ngx_recv.o \
objs/src/os/unix/ngx_readv_chain.o \
objs/src/os/unix/ngx_udp_recv.o \
objs/src/os/unix/ngx_send.o \
objs/src/os/unix/ngx_writev_chain.o \
objs/src/os/unix/ngx_udp_send.o \
objs/src/os/unix/ngx_udp_sendmsg_chain.o \
objs/src/os/unix/ngx_channel.o \
objs/src/os/unix/ngx_shmem.o \
objs/src/os/unix/ngx_process.o \
objs/src/os/unix/ngx_daemon.o \
objs/src/os/unix/ngx_setaffinity.o \
objs/src/os/unix/ngx_setproctitle.o \
objs/src/os/unix/ngx_posix_init.o \
objs/src/os/unix/ngx_user.o \
objs/src/os/unix/ngx_dlopen.o \
objs/src/os/unix/ngx_process_cycle.o \
objs/src/os/unix/ngx_linux_init.o \
objs/src/event/modules/ngx_epoll_module.o \
objs/src/os/unix/ngx_linux_sendfile_chain.o \
objs/src/core/ngx_regex.o \
objs/src/http/ngx_http.o \
objs/src/http/ngx_http_core_module.o \
objs/src/http/ngx_http_special_response.o \
objs/src/http/ngx_http_request.o \
objs/src/http/ngx_http_parse.o \
objs/src/http/modules/ngx_http_log_module.o \
objs/src/http/ngx_http_request_body.o \
objs/src/http/ngx_http_variables.o \
objs/src/http/ngx_http_script.o \
objs/src/http/ngx_http_upstream.o \
objs/src/http/ngx_http_upstream_round_robin.o \
objs/src/http/ngx_http_file_cache.o \
objs/src/http/ngx_http_write_filter_module.o \
objs/src/http/ngx_http_header_filter_module.o \
objs/src/http/modules/ngx_http_chunked_filter_module.o \
objs/src/http/modules/ngx_http_range_filter_module.o \
objs/src/http/modules/ngx_http_gzip_filter_module.o \
objs/src/http/ngx_http_postpone_filter_module.o \
objs/src/http/modules/ngx_http_ssi_filter_module.o \
objs/src/http/modules/ngx_http_charset_filter_module.o \
objs/src/http/modules/ngx_http_userid_filter_module.o \
objs/src/http/modules/ngx_http_headers_filter_module.o \
objs/src/http/ngx_http_copy_filter_module.o \
objs/src/http/modules/ngx_http_not_modified_filter_module.o \
objs/src/http/modules/ngx_http_static_module.o \
objs/src/http/modules/ngx_http_autoindex_module.o \
objs/src/http/modules/ngx_http_index_module.o \
objs/src/http/modules/ngx_http_mirror_module.o \
objs/src/http/modules/ngx_http_try_files_module.o \
objs/src/http/modules/ngx_http_auth_basic_module.o \
objs/src/http/modules/ngx_http_access_module.o \
objs/src/http/modules/ngx_http_limit_conn_module.o \
objs/src/http/modules/ngx_http_limit_req_module.o \
objs/src/http/modules/ngx_http_geo_module.o \
objs/src/http/modules/ngx_http_map_module.o \
objs/src/http/modules/ngx_http_split_clients_module.o \
objs/src/http/modules/ngx_http_referer_module.o \
objs/src/http/modules/ngx_http_rewrite_module.o \
objs/src/http/modules/ngx_http_proxy_module.o \
objs/src/http/modules/ngx_http_fastcgi_module.o \
objs/src/http/modules/ngx_http_uwsgi_module.o \
objs/src/http/modules/ngx_http_scgi_module.o \
objs/src/http/modules/ngx_http_memcached_module.o \
objs/src/http/modules/ngx_http_empty_gif_module.o \
objs/src/http/modules/ngx_http_browser_module.o \
objs/src/http/modules/ngx_http_upstream_hash_module.o \
objs/src/http/modules/ngx_http_upstream_ip_hash_module.o \
objs/src/http/modules/ngx_http_upstream_least_conn_module.o \
objs/src/http/modules/ngx_http_upstream_random_module.o \
objs/src/http/modules/ngx_http_upstream_keepalive_module.o \
objs/src/http/modules/ngx_http_upstream_zone_module.o \
objs/addon/src/ndk.o \
objs/addon/src/ngx_http_php_module.o \
objs/addon/src/ngx_http_php_core.o \
objs/addon/src/ngx_http_php_directive.o \
objs/addon/src/ngx_http_php_handler.o \
objs/addon/src/ngx_http_php_request.o \
objs/addon/src/ngx_http_php7_zend_uthread.o \
objs/addon/src/ngx_http_php8_zend_uthread.o \
objs/addon/src/ngx_http_php_zend_uthread.o \
objs/addon/src/ngx_http_php_sleep.o \
objs/addon/src/ngx_http_php_socket.o \
objs/addon/src/ngx_http_php_util.o \
objs/addon/src/ngx_http_php_variable.o \
objs/addon/src/ngx_http_php_header.o \
objs/addon/src/ngx_http_php_keepalive.o \
objs/addon/src/ngx_php_debug.o \
objs/addon/src/ngx_php_conf_file.o \
objs/addon/impl/php_ngx.o \
objs/addon/impl/php_ngx_core.o \
objs/addon/impl/php_ngx_log.o \
objs/addon/impl/php_ngx_request.o \
objs/addon/impl/php_ngx_socket.o \
objs/addon/impl/php_ngx_var.o \
objs/addon/impl/php_ngx_sockets.o \
objs/addon/impl/php_ngx_header.o \
objs/addon/impl/php_ngx_cookie.o \
objs/ngx_modules.o \
-Wl,-rpath,/usr/lib64/php -ldl -lpthread -lcrypt -lcrypt -largon2 -lresolv -lcrypt -ledit -lncurses -lstdc++ -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcrypt -largon2 -lcrypt -L/usr/lib64/php -lphpU -lpcre -lz \
-Wl,-E
/usr/bin/ld: cannot find -lphpU
collect2: error: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/root/nginx-1.16.1'
make: *** [build] Error 2
[root@khotrungviet nginx-1.16.1]# lscpu
OS: CentOS 7
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
Stepping: 1
CPU MHz: 2199.998
BogoMIPS: 4399.99
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap xsaveopt md_clear spec_ctrl
Hello dude i again here :) my problem is not fully solved, look this;
it's not complete, but it's logic
i did use this but this is not worked, 404 does not;
i need this:
Example:
(php counts how many times each user enters)
php variable if 100, nginx variable 1 do
if nginx variable 1, go return 404 else go location /
i need to do this, can u help again me ? @rryqszq4
That's the right logic, but it doesn't work;
Hi,
I want to require
(include
) a file in the init_worker_by_php
, but later I can't use the functions in the file.
Example
init_worker_by_php '
require "app.php";
';
server {
listen 8080 default_server reuseport;
root /;
index index.html;
location = /db {
add_header Content-Type application/json;
content_by_php '
db(); // Function in app.php
';
}
And return this error:
Fatal error: Uncaught Error: Call to undefined function db() in ngx_php eval ...
Try to add server-side prepared statements.
Info:
https://dev.mysql.com/doc/refman/8.0/en/sql-syntax-prepared-statements.html
https://dev.mysql.com/doc/refman/8.0/en/c-api-prepared-statements.html
case a core dump, failed to open stream: No such file or directory
include('nothing');
How to write simple php script using ngx_php to add/remove the upstream list of nginx,
As interval php scripts run and check health of upstream and remove it if theire down or not healthy ?
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com weight=3;
server backend3.example.com:8080;
}
?
when compiling the module there is an error:
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:254:5: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
NULL,
^~~~
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:254:5: note: (near initialization for 'php_ngx_module.php_ini_ignore')
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:255:5: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
NULL,
^~~~
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:255:5: note: (near initialization for 'php_ngx_module.php_ini_ignore_cwd')
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:267:5: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
NULL,
^~~~
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:267:5: note: (near initialization for 'php_ngx_module.phpinfo_as_text')
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:273:5: error: excess elements in struct initializer [-Werror]
NULL,
^~~~
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:273:5: note: (near initialization for 'php_ngx_module')
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:274:5: error: excess elements in struct initializer [-Werror]
NULL
^~~~
/opt/ngx_php7-0.0.3/src/php/php_ngx.c:274:5: note: (near initialization for 'php_ngx_module')
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1208: objs/addon/php/php_ngx.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/opt/nginx-1.9.15'
make: *** [Makefile:8: build] Error 2
First of all, fantastic work. I have been using nginx lua module for a long time, but I'm more familiar with PHP so it would be great to use PHP. Since nginx is all about performance, I wonder how this module performs? Also, with the new PHP JIT (8.0), can we take advantage of JIT just like lua jit?
I followed this because of noting results on Techempower benchmarks #19. A link to the benchmark code would be nice.
Following instructions, I had success with this, on setting up nginx 1.19.0 and php 7.4.7, and running a few local php scripts from browser. I have callled a few of the ngx_php7 API. I note that the static class method call versions did not work.
On my system, nginx compiled the ngx_php addon directly into the nginx binary.
On testing some scripts, I found.
API ngx_request::server_protocol(void) : string produced an error, but ngx_request_server_protocol(void) : string worked OK.
I make a guess here, and ask to confirm. Is it true that PHP does automatically write back to the open socket stream connection given by nginx as default?
I note that require once only works for one invocation, after which all classes remain defined. It is similar to the new php code preload facility which I haven't yet made to work.
Too many PHP frameworks that I know all make some anchoring usage of class static variable, instance singleton, or global.
hello
I tried compile ngx_php7 on
11.1-RELEASE-p8 FreeBSD amd64 but recieve this error:
/usr/work/src/nginxPhp/ngx_php7/src/php/impl/php_ngx_track.c:513:38: error: address of 'execute_data->func->common' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
if (&execute_data->func->common) {
~~ ~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/work/src/nginxPhp/ngx_php7/src/php/impl/php_ngx_track.c:525:38: error: address of 'execute_data->func->op_array' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
if (&execute_data->func->op_array) {
~~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
2 errors generated.
*** Error code 1
Stop.
make[1]: stopped in /usr/work/src/nginxPhp/nginx-1.10.3
*** Error code 1
Stop.
make: stopped in /usr/work/src/nginxPhp/nginx-1.10.3
Your know where issue?
We have an async mysql connection https://github.com/rryqszq4/ngx_php7/blob/master/t/lib/mysql.php
But the biggest cost is the time connecting via TCP to the db.
Any persistent app use a pool of connections, so they don't have the overhead of connect and disconnect.
Example in swoole:
https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/PHP/swoole/swoole-server.php#L188-L247
When there are errors never return a 4xx or 5xx.
Always return a socket read error.
So we don't know if it is a problem with PHP or with the socket or nginx.
The error log show exactly the errors.
Hello,
https://github.com/rryqszq4/ngx_php7 . I'm doing installations this way after
i did add php pdo after I'm doing installations this way but no have driver php pdo.
I haven't tried all the insertion methods,
how can I do that.
it could work for other people
can u help me @rryqszq4 ?
ngx_post_args access_by_php not working
I need more information how to develop php app using composer or other tools for ngx_php7.
Any documentation and guide ?
按理来说,如果采用zts模式,是不是可以解决全局变量和单例的问题,同时请求配合上线程池的方式,控制整体并发。
ngx_post_args() input type file not working
You get multiple definitionof 'ngx_php_request'
, multiple definition of 'old_zend_error_cb'
error when building on fedora 32.
...
cc -o objs/ngx_http_php_module.so \
objs/addon/src/ngx_http_php_module.o \
objs/addon/src/ngx_http_php_core.o \
objs/addon/src/ngx_http_php_directive.o \
objs/addon/src/ngx_http_php_handler.o \
objs/addon/src/ngx_http_php_request.o \
objs/addon/src/ngx_http_php_zend_uthread.o \
objs/addon/src/ngx_http_php_sleep.o \
objs/addon/src/ngx_http_php_socket.o \
objs/addon/src/ngx_http_php_util.o \
objs/addon/src/ngx_http_php_variable.o \
objs/addon/src/ngx_http_php_header.o \
objs/addon/src/ngx_http_php_keepalive.o \
objs/addon/src/ngx_php_debug.o \
objs/addon/src/ngx_php_conf_file.o \
objs/addon/impl/php_ngx.o \
objs/addon/impl/php_ngx_core.o \
objs/addon/impl/php_ngx_log.o \
objs/addon/impl/php_ngx_request.o \
objs/addon/impl/php_ngx_socket.o \
objs/addon/impl/php_ngx_var.o \
objs/addon/impl/php_ngx_sockets.o \
objs/addon/impl/php_ngx_header.o \
objs/addon/impl/php_ngx_cookie.o \
objs/ngx_http_php_module_modules.o \
-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E -Wl,-rpath,/usr/lib64 -lcrypt -lresolv -lcrypt -lncurses -lrt -lstdc++ -lrt -lm -ldl -lxml2 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lpcre2-8 -lz -ledit -lcrypt -lcrypt -L/usr/lib64 -lphp7 -shared
/usr/bin/ld: objs/addon/src/ngx_http_php_core.o:(.bss+0x0): multiple definitionof `ngx_php_request'; objs/addon/src/ngx_http_php_module.o:(.bss+0x0): first defined here
/usr/bin/ld: objs/addon/src/ngx_http_php_core.o:/app/build/nginx-1.18.0/../../src/ngx_http_php_core.h:177: multiple definition of `old_zend_error_cb'; objs/addon/src/ngx_http_php_module.o:/app/build/nginx-1.18.0/../../src/ngx_http_php_core.h:177: first defined here
..
./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..
We could try that:
https://bugs.php.net/bug.php?id=65078
And if work without problem, create a bug request to add the ngx_php7 sapi.
Ubuntu 20.04 64bit
PHP 8.1 from PPA
nginx-1.20.02 (1.18.0 the same error)
In file included from /usr/include/string.h:495, from /usr/include/php/20210902/main/php_config.h:2167, from /usr/include/php/20210902/main/php.h:30, from /root/ngx_http_php7_module/src/ngx_http_php_module.h:32, from /root/ngx_http_php7_module/src/ngx_http_php_util.c:29: In function ‘strncat’, inlined from ‘str_replace’ at /root/ngx_http_php7_module/src/ngx_http_php_util.c:69:5: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin_strncat’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] 136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /root/ngx_http_php7_module/src/ngx_http_php_util.c: In function ‘str_replace’: /root/ngx_http_php7_module/src/ngx_http_php_util.c:69:5: note: length computed here 69 | strncat(result, replace, strlen(replace)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [objs/Makefile:1402: objs/addon/src/ngx_http_php_util.o] Error 1 make[1]: Leaving directory '/root/nginx-1.20.2' make: *** [Makefile:10: build] Error 2
A simple application example, I hope it will be helpful to the users of NGX-PHP:
UPD, how to : https://soulteary.com/2022/10/05/nginx-black-magic-low-cost-high-performance-applications-using-ngx-php-modules.html
As the ppa:ondrej/php
include now php8.1-rc5
, I'm testing the frameworks for the benchmark.
And it's failing with php-ngx:
php-ngx: Step 9/11 : 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
php-ngx: ---> Running in 1bd6b3cff392
php-ngx: /ngx_php7/src/ngx_http_php_module.c: In function 'ngx_http_php_init_worker':
php-ngx: /ngx_php7/src/ngx_http_php_module.c:765:23: error: assignment to 'void (*)(int, const char *, const uint32_t, zend_string *)' {aka 'void (*)(int, const char *, const unsigned int, struct _zend_string *)'} from incompatible pointer type 'void (*)(int, zend_string *, const uint32_t, zend_string *)' {aka 'void (*)(int, struct _zend_string *, const unsigned int, struct _zend_string *)'} [-Werror=incompatible-pointer-types]
php-ngx: 765 | old_zend_error_cb = zend_error_cb;
php-ngx: | ^
php-ngx: /ngx_php7/src/ngx_http_php_module.c:766:19: error: assignment to 'void (*)(int, zend_string *, const uint32_t, zend_string *)' {aka 'void (*)(int, struct _zend_string *, const unsigned int, struct _zend_string *)'} from incompatible pointer type 'void (*)(int, const char *, const uint32_t, zend_string *)' {aka 'void (*)(int, const char *, const unsigned int, struct _zend_string *)'} [-Werror=incompatible-pointer-types]
php-ngx: 766 | zend_error_cb = ngx_php_error_cb;
php-ngx: | ^
php-ngx: cc1: all warnings being treated as errors
php-ngx: make[1]: *** [objs/Makefile:1286: objs/addon/src/ngx_http_php_module.o] Error 1
php-ngx: make: *** [Makefile:10: build] Error 2
php-ngx: Removing intermediate container 1bd6b3cff392
php-ngx: Docker build failed; terminating
The final version php-8.1 is for 25 from this month.
In php, set upstream connection pool size.
Please, could you explain a little more what is it and what do ?
Than you.
I was able to compile it without any problem however after i add load on nginx.conf and i tried nginx -t
i got this err
nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_php_module.so" failed (/etc/nginx/modules/ngx_http_php_module.so: undefined symbol: zif_dl) in /etc/nginx/nginx.conf:15
i was searching around but found nothing about this, can you please help?
root@proxy2:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
root@proxy2:~# php -v
PHP 7.0.33-1+ubuntu18.10.1+deb.sury.org+1 (cli) (built: Dec 7 2018 08:28:57) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.0.33-1+ubuntu18.10.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
root@proxy2:~# nginx -v
nginx version: nginx/1.15.7 (nginx-plus-r17)
root@proxy2:~# cat /nginx/nginx.conf | grep "load"
load_module modules/ngx_http_geoip2_module.so;
load_module modules/ngx_stream_geoip2_module.so;
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_php_module.so;
root@proxy2:~#
This is a very good project, but the existing socket request method is too low-level. If it is to be used more, asynchronous http/https request method and websocket need to be supported.
Hello, How it's possible to set $_SERVER variables
for example for general usage of fastcgi
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
how should it be for the module?
Thank you.
Timer::add($time_interval, function () {
echo "Timer run";
});
https://www.nginx.com/resources/wiki/extending/api/event/#ngx-add-timer
using a strtotime() for $time_interval
https://www.php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-examples
Also a recurring timer.
Thanks for your great job.
When I use the log_by_php directive, the ngx_http_php_zend_uthread_log_inline_routine is called 3 time for each web request, and one of them triggers segfault.
The PHP code are executed once though.
The block-version function (log_by_php_block) is not working but not quite sure about the reason. My guess is that at line 200 of /src/ngx_http_php_directive.c, there's a plcf->log_code = code; it could be plcf->log_inline_code = code.
My PHP version is 7.2, nginx version is 1.12.2.
Let me know if there's a solution to this.
Thanks in advance!
While testing the project using docker, following the readme I get to
./configure: error: invalid option "-fomit-frame-pointer'"
➜ ngx_php7 git:(master) # using commit id a7a0af416a0034580321b7ecdf17be65f6b9898e
➜ ngx_php7 git:(master) docker build -t nginx-php7 .
Sending build context to Docker daemon 1.161MB
Step 1/10 : FROM nginx:stable-alpine as ngx-php
---> aaad4724567b
Step 2/10 : COPY config /build/config
---> Using cache
---> 6aef7738475f
Step 3/10 : COPY src /build/src
---> Using cache
---> 8a7b9f8702e3
Step 4/10 : COPY third_party /build/third_party
---> Using cache
---> 895510b51acd
Step 5/10 : ENV PHP_LIB=/usr/lib
---> Using cache
---> 0dfa98a35f22
Step 6/10 : WORKDIR /build
---> Using cache
---> 51098db4bda6
Step 7/10 : RUN 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 && 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
---> Running in 24d95c1a030f
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/54) Upgrading libcrypto1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(2/54) Upgrading libssl1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(3/54) Installing ca-certificates (20190108-r0)
(4/54) Installing nghttp2-libs (1.39.2-r0)
(5/54) Installing libcurl (7.66.0-r0)
(6/54) Installing curl (7.66.0-r0)
(7/54) Installing libgcc (8.3.0-r0)
(8/54) Installing libstdc++ (8.3.0-r0)
(9/54) Installing binutils (2.32-r0)
(10/54) Installing gmp (6.1.2-r1)
(11/54) Installing isl (0.18-r0)
(12/54) Installing libgomp (8.3.0-r0)
(13/54) Installing libatomic (8.3.0-r0)
(14/54) Installing mpfr3 (3.1.5-r1)
(15/54) Installing mpc1 (1.1.0-r0)
(16/54) Installing gcc (8.3.0-r0)
(17/54) Installing musl-dev (1.1.22-r3)
(18/54) Installing libc-dev (0.7.1-r0)
(19/54) Installing g++ (8.3.0-r0)
(20/54) Installing gd (2.2.5-r2)
(21/54) Installing perl (5.28.2-r1)
(22/54) Installing pkgconf (1.6.1-r1)
(23/54) Installing gd-dev (2.2.5-r2)
(24/54) Installing geoip-dev (1.6.12-r1)
(25/54) Installing ncurses-dev (6.1_p20190518-r0)
(26/54) Installing libedit-dev (20190324.3.1-r0)
(27/54) Installing zlib-dev (1.2.11-r1)
(28/54) Upgrading libxml2 (2.9.9-r2 -> 2.9.9-r3)
(29/54) Installing libxml2-dev (2.9.9-r3)
(30/54) Upgrading libxslt (1.1.33-r1 -> 1.1.33-r3)
(31/54) Installing libxslt-dev (1.1.33-r3)
(32/54) Installing linux-headers (4.19.36-r0)
(33/54) Installing make (4.2.1-r2)
(34/54) Installing openssl-dev (1.1.1d-r2)
(35/54) Installing libattr (2.4.48-r0)
(36/54) Installing attr (2.4.48-r0)
(37/54) Installing paxmark (0.11-r1)
(38/54) Installing libpcre16 (8.43-r0)
(39/54) Installing libpcre32 (8.43-r0)
(40/54) Installing libpcrecpp (8.43-r0)
(41/54) Installing pcre-dev (8.43-r0)
(42/54) Installing perl-utils (5.28.2-r1)
(43/54) Installing perl-dev (5.28.2-r1)
(44/54) Installing php7-common (7.3.13-r0)
(45/54) Installing argon2-libs (20171227-r2)
(46/54) Installing pcre2 (10.33-r0)
(47/54) Installing php7 (7.3.13-r0)
(48/54) Installing m4 (1.4.18-r1)
(49/54) Installing autoconf (2.69-r2)
(50/54) Installing libpcre2-16 (10.33-r0)
(51/54) Installing libpcre2-32 (10.33-r0)
(52/54) Installing pcre2-dev (10.33-r0)
(53/54) Installing php7-dev (7.3.13-r0)
(54/54) Installing php7-embed (7.3.13-r0)
Executing busybox-1.30.1-r2.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 301 MiB in 87 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 && 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
➜ ngx_php7 git:(master) docker -v
Docker version 19.03.5, build 633a0ea838
Hi
After updating the Dstats of the benchmark, php-ngx is consuming excessive memory. We need to find where is that problem. Because also affect the performance surely.
The servers in Citrine have 32 Gb memory, and php-ngx is using it near to the limit.
Platform | Memory in Mb |
---|---|
Php-ngx-mysql | 32.422 |
Php-ngx-psql | 27.235 |
Php-ngx-async | 12.500 |
Openresty | 2.217 |
Workerman-pgsql | 1.112 |
https://ajdust.github.io/tfbvis/
When I tried to use 4x workers per cpu core in php-ngx-pgsql, like we do with Workerman, go and others, php-ngx was unable to start and send this error:
At first I didn't know where was the problem, but now it's clear that is using more memory than the server have.
But php-ngx is performing magnificently :) and still can grow much more in performance.
Thank you
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:381:5: error: use of undeclared identifier 'ndk_set_var_t'
ndk_set_var_t filter;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:395:5: error: use of undeclared identifier 'filter'
filter.type = NDK_SET_VAR_MULTI_VALUE_DATA;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:395:19: error: use of undeclared identifier 'NDK_SET_VAR_MULTI_VALUE_DATA'
filter.type = NDK_SET_VAR_MULTI_VALUE_DATA;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:396:5: error: use of undeclared identifier 'filter'
filter.func = cmd->post;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:397:5: error: use of undeclared identifier 'filter'
filter.size = cf->args->nelts - 3;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:404:25: error: use of undeclared identifier 'filter'
filter_data->size = filter.size;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:413:5: error: use of undeclared identifier 'filter'
filter.data = filter_data;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:415:12: error: implicit declaration of function 'ndk_set_var_multi_value_core' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return ndk_set_var_multi_value_core(cf, &target, &value[3], &filter);
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:415:66: error: use of undeclared identifier 'filter'
return ndk_set_var_multi_value_core(cf, &target, &value[3], &filter);
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:423:5: error: use of undeclared identifier 'ndk_set_var_t'
ndk_set_var_t filter;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:437:5: error: use of undeclared identifier 'filter'
filter.type = NDK_SET_VAR_MULTI_VALUE_DATA;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:437:19: error: use of undeclared identifier 'NDK_SET_VAR_MULTI_VALUE_DATA'
filter.type = NDK_SET_VAR_MULTI_VALUE_DATA;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:438:5: error: use of undeclared identifier 'filter'
filter.func = cmd->post;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:439:5: error: use of undeclared identifier 'filter'
filter.size = cf->args->nelts - 3;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:446:25: error: use of undeclared identifier 'filter'
filter_data->size = filter.size;
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:455:5: error: implicit declaration of function 'PHP_EMBED_START_BLOCK' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
PHP_EMBED_START_BLOCK(0, NULL);
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:459:31: error: use of undeclared identifier 'IS_BOOL'
if (Z_TYPE(retval) == IS_BOOL ||
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:475:5: error: implicit declaration of function 'PHP_EMBED_END_BLOCK' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
PHP_EMBED_END_BLOCK();
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:475:5: note: did you mean 'PHP_EMBED_START_BLOCK'?
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:455:5: note: 'PHP_EMBED_START_BLOCK' declared here
PHP_EMBED_START_BLOCK(0, NULL);
^
/Users/weizhao/Downloads/ngx_php7/src/ngx_http_php_directive.c:484:5: error: use of undeclared identifier 'filter'
filter.data = filter_data;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [objs/addon/src/ngx_http_php_directive.o] Error 1
make: *** [build] Error 2
PHP 7.0.7 (cli) (built: Jun 23 2016 18:14:55) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
nginx-1.11.10
macOS sierra 10.12.5 (16F73)
有办法优化ngx_php7把那些yield去掉变成跟ngx_lua一样的写法么?
content_by_php '
yield ngx_socket::connect("hq.sinajs.cn", 80);
yield ngx_socket::send("GET /list=s_sh000001 HTTP/1.0\r\n
Host: hq.sinajs.cn\r\nConnection: close\r\n\r\n");
yield $ret = ngx_socket::recv(1024);
yield ngx_socket::close();
var_dump($ret);
';
变成:
content_by_php '
ngx_socket::connect("hq.sinajs.cn", 80);
ngx_socket::send("GET /list=s_sh000001 HTTP/1.0\r\n
Host: hq.sinajs.cn\r\nConnection: close\r\n\r\n");
$ret = ngx_socket::recv(1024);
ngx_socket::close();
var_dump($ret);
';
I am trying that:
<?php
//app_async.php called from init_worker_by_php
require_once '/ngx_php7/t/lib/mysql.php';
define('DB_HOST', gethostbyname('tfb-database'));
define('DB_PORT', '3306');
define('DB_USER', 'benchmarkdbuser');
define('DB_PASS', 'benchmarkdbpass');
define('DB_NAME', 'hello_world');
$my = new php\ngx\mysql();
yield from $my->connect(DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME);
function db()
{
ngx_header_set('Content-Type', 'application/json');
global $my;
echo json_encode(
(yield from $my->query('SELECT id,randomNumber FROM World WHERE id = '.mt_rand(1, 10000)))[0]
);
}
And get this error:
php-ngx-async: 2019/11/04 13:50:35 [error] 9#0: *1 Fatal error: Uncaught Error: Call to undefined function db() in ngx_php eval code:2
php-ngx-async: Stack trace:
php-ngx-async: #0 [internal function]: ngx_content_50c025ec7080d0b5458512d034e7a3bb()
php-ngx-async: #1 [internal function]: Generator->valid()
php-ngx-async: #2 {main}
php-ngx-async: thrown in ngx_php eval code on line 2, client: 172.18.0.5, server: , request: "GET /db HTTP/1.1", host: "tfb-server:8080"
php-ngx-async: 2019/11/04 13:50:35 [error] 9#0: *1 ngx_php ctx is nil at content inline handler. while keepalive, client: 172.18.0.5, server: 0.0.0.0:8080
Hello dude,
Doing a cookie operation with php file not working
current issues:
nginx version in nginx:stable-alpine
is nginx version: nginx/1.20.2
, maybe we should provide an updated version to verify that the program builds and works correctly.
maybe the project maintainer can provide an official image, which can lower the threshold for users to use :D
When using ngx_request_headers these are the only headers I get back:
HOST
CONNECTION
CACHE_CONTROL
UPGRADE_INSECURE_REQUESTS
USER_AGENT
ACCEPT
ACCEPT_ENCODING
ACCEPT_LANGUAGE
REFERER
I've tried sending custom headers with cURL and they are not included in the ngx_request_headers array. Ex:
curl -e "https://fakeded.referer" -H "X-Forwarded-For: 192.168.0.1" -H "foo: bar" http://test.com
`user www www;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
client_max_body_size 64k;
client_body_buffer_size 64k;
php_ini_path /etc/php.ini;
server {
listen 80;
server_name localhost;
default_type 'application/json; charset=UTF-8';
set $sel 0;
location = / {
access_by_php '
$x = 1;
ngx_var::set("sel", $x);
';
return 200 $sel;
}
}
}`
return 200 $sel; 0 gives
How ı can do ? Can u help me ?
using Cloudflare, x-forwarded-for real ip not working
ngx-php/src/ngx_http_php8_zend_uthread.c
Line 44 in 73ef8b1
OS: Fedora 35
php: 8.1 remi (php81)
nginx: 1.21.5
Error:
In the file included from /opt/remi/php81/root/usr/include/php/Zend/zend_dtrace_gen.h:10,
from /opt/remi/php81/root/usr/include/php/Zend/zend_dtrace.h:38,
from /ngx_php7/src/ngx_http_php8_zend_uthread.c:36:
/ngx_php7/src/ngx_http_php8_zend_uthread.c: In the function ‘ngx_http_php_zend_throw_exception_internal’:
/opt/remi/php81/root/usr/include/php/Zend/zend_dtrace_gen.h:32:1: error: memory entry 0 is not directly addressable
32 | DTRACE_PROBE1 (php, exception__thrown, arg1)
| ^ ~~~~~~~~~~~~
/ngx_php7/src/ngx_http_php8_zend_uthread.c:436:13: note: macro expansion ‘DTRACE_EXCEPTION_THROWN’
436 | DTRACE_EXCEPTION_THROWN (ZSTR_VAL (exception-> ce-> name));
| ^ ~~~~~~~~~~~~~~~~~~~~~~
/opt/remi/php81/root/usr/include/php/Zend/zend_dtrace_gen.h:32:1: error: memory entry 0 is not directly addressable
32 | DTRACE_PROBE1 (php, exception__thrown, arg1)
| ^ ~~~~~~~~~~~~
/ngx_php7/src/ngx_http_php8_zend_uthread.c:438:13: note: macro expansion ‘DTRACE_EXCEPTION_THROWN’
438 | DTRACE_EXCEPTION_THROWN (NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~
Code:
export NGINX_VER=1.21.5 && export OPENSSL_VER=3.0.1 && export HEADERMOD_VER=0.33 && export PHP_VERSION=php81 && export PHP_CONFIG=/opt/remi/${PHP_VERSION}/root/usr/bin/php-config && export PHP_BIN=/opt/remi/${PHP_VERSION}/root/usr/bin && export PHP_INC=/opt/remi/${PHP_VERSION}/root/usr/include/php && export PHP_LIB=/opt/remi/${PHP_VERSION}/root/usr/lib64
mkdir -p /usr/local/src/nginx/modules
cd /usr/local/src/nginx/modules
git clone https://github.com/rryqszq4/ngx_php7.git && wget https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERMOD_VER}.tar.gz && tar xaf v${HEADERMOD_VER}.tar.gz && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module && wget https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz && tar xaf openssl-${OPENSSL_VER}.tar.gz && cd openssl-${OPENSSL_VER}
./config
cd /usr/local/src/nginx/
wget -qO- https://nginx.org/download/nginx-${NGINX_VER}.tar.gz | tar zxf -
cd nginx-${NGINX_VER}
wget https://raw.githubusercontent.com/nginx-modules/ngx_http_tls_dyn_size/master/nginx__dynamic_tls_records_1.17.7%2B.patch -O tcp-tls.patch
patch -p1 <tcp-tls.patch
wget https://raw.githubusercontent.com/hakasenyang/openssl-patch/master/nginx_hpack_push_1.15.3.patch -O nginx_http2_hpack.patch
patch -p1 <nginx_http2_hpack.patch
./configure --user=nginx --group=nginx --prefix=/etc/nginx --with-pcre-jit --with-mail --with-debug --with-file-aio --with-mail_ssl_module --with-stream --with-stream_ssl_module --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --with-cc-opt=-Wno-deprecated-declarations --with-cc-opt=-Wno-ignored-qualifiers --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_mp4_module --with-http_auth_request_module --with-http_slice_module --with-http_stub_status_module --with-http_realip_module --with-http_sub_module --add-module=/usr/local/src/nginx/modules/headers-more-nginx-module-${HEADERMOD_VER} --add-module=/usr/local/src/nginx/modules/ngx_http_substitutions_filter_module --with-openssl=/usr/local/src/nginx/modules/openssl-${OPENSSL_VER} --with-http_v2_hpack_enc --with-ld-opt="-Wl,-rpath,$PHP_LIB" --add-module=/usr/local/src/nginx/modules/ngx_php7/third_party/ngx_devel_kit --add-module=/usr/local/src/nginx/modules/ngx_php7
make -j "$(nproc)"
make install
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:)
When using multiqueries.
while ($query_count--) {
$id = mt_rand(1, 10000);
$world = (yield from $my->query("SELECT id,randomNumber FROM World WHERE id = $id"))[0];
$world['randomNumber'] = mt_rand(1, 10000);
$update .="UPDATE World SET randomNumber = {$world['randomNumber']} WHERE id = $id;";
$arr[] = $world;
}
yield from $my->query($update);
The update fail.
https://travis-ci.org/TechEmpower/FrameworkBenchmarks/jobs/608620366#L1423
Module loading error when dtrace is enabled in php configure.
$ php-config --configure-options
.. --enable-dtrace ..
$ nginx -t
nginx: [emerg] dlopen() "/usr/lib64/nginx/modules/ngx_http_php_module.so" failed (/usr/lib64/nginx/modules/ngx_http_php_module.so: undefined symbol: DTRACE_EXCEPTION_THROWN_ENABLED) in /usr/share/nginx/modules/php.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
there is no problem if there is no
--enable-dtrace
option.
Hello dude i did try "extension=mongodb.so" but not worked
Can u help me, can you throw me in progress? step by step ? @rryqszq4
didn't work in any way
i try this https://github.com/mongodb/mongo-php-library
Hello. I had found some issues when I trying to use "try_files" directive. Below are my nginx.conf
init_worker_by_php_block {
class a {
static $a = 1;
public static function add_one(){
a::$a += 1;
}
}
}
server {
server_name localhost;
listen 808;
location / {
index index.html index.htm;
try_files $uri $uri/ /index.php;
}
location /index.php{
content_by_php_block {
ngx_header_set("Content-Type", "text/html; charset=UTF-8");
echo "12312\n";
a::add_one();
var_dump(a::$a);
}
}
location /favicon.ico{
return 403;
}
}
when I open "http://localhost:808/p", A blank page with status code 200 was returned. But when I open "http://localhost:808/index.php", Everything was just fine. And the code in "content_by_php_block" is seen not be run in "http://localhost:808/p" because the a::$a is not add after the request. Is there anything I misunderstanding?
I think this project is a very good project, so that Nginx can do a lot more.
However, it may be too long for the project to be submitted for testing by anyone other than the author, and the default project cannot be built.
For this I submitted a small improvement: #130
In order to use it more efficiently, I pre-built it: https://github.com/nginx-with-docker/ngx_http_php_module
And adjusted the build image and script, so that this module can be built locally with each newly launched version of nginx.
If the author thinks this method will be better, I can submit a PR with improved build image at a later date, like this: https://github.com/nginx-with-docker/ngx_http_php_module/blob/main/docker/master/Dockerfile.alpine
I believe this can greatly reduce the compilation problems encountered by various users. @rryqszq4
The image based on the latest code base can be downloaded from here:
docker pull soulteary/prebuilt-nginx-modules:ngx-1.21.1-php-master-alpine
If anyone has a need, I will add a pre-built image of the Debian version.
When using ngx_var_get to get nginx variables the function will core dump on some variables if they are not set.
EX: ngx_var_get("referer"); will result in a core if the header doesn't exist. it works if the header is set. The work around is to put this in the nginx config:
set $ref $http_referer;
and use: ngx_var_get("ref");
However, if one uses:
ngx_var_get("https");
it will not core nginx if the variable https is not set in nginx
Hi @rryqszq4 , my side was follow your instruction try to install for php 8.0 + nginx 1.23.1
However i am stuck at this place
yum install nginx-module-php7 (your existing instruction)
yum install nginx-module-php8 (i am stuck here, this repo not exist, how can i manual to fix this myself / build myself to continue remaining installation part as below ? )
Edit nginx.conf and load the required modules at the top:
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_php_module.so;
Like what is the needed config to be able to run Wordpress sites without using PHP-FPM?
Just PHP/Nginx with this module.
Hello, i am using proxy_pass and i need to take the result ( the response body in a variable). Is there any way?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.