Skip to content

Failed to compile custom language module for PHP 5.2.17 with Unit 1.30 #858

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

Closed
ylighgh opened this issue Apr 9, 2023 · 3 comments
Closed

Comments

@ylighgh
Copy link

ylighgh commented Apr 9, 2023

Why did I fail to compile the PHP 5.2.17 language module on my computer and what can I do to resolve it?

[root@cky-kvm-1 ~]# /usr/local/php-5.2.17/bin/php-config
Usage: /usr/local/php-5.2.17/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php-5.2.17]
  --includes          [-I/usr/local/php-5.2.17/include/php -I/usr/local/php-5.2.17/include/php/main -I/usr/local/php-5.2.17/include/php/TSRM -I/usr/local/php-5.2.17/include/php/Zend -I/usr/local/php-5.2.17/include/php/ext -I/usr/local/php-5.2.17/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/openssl-1.0.1/lib]
  --libs              [-lcrypt   -lcrypt -lrt -lmcrypt -lfreetype -lpng -lz -ljpeg -lgdbm -lcurl -lrt -lm  -lxml2 -lz -llzma -lm -lssl -lcrypto -lcurl -lxml2 -lz -llzma -lm -lxml2 -lz -llzma -lm -lcrypt -lxml2 -lz -llzma -lm -lxml2 -lz -llzma -lm -lxml2 -lz -llzma -lm -lcrypt ]
  --extension-dir     [/usr/local/php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613]
  --include-dir       [/usr/local/php-5.2.17/include/php]
  --php-binary        [NONE]
  --php-sapis         [embed]
  --configure-options [--enable-embed --disable-cli --prefix=/usr/local/php-5.2.17 --with-config-file-path=/usr/local/php-5.2.17/etc --with-config-file-scan-dir=/usr/local/php-5.2.17/etc/php.d --with-fpm-conf=/usr/local/php-5.2.17/etc/php-fpm.conf --with-fpm-log=/usr/local/php-5.2.17/var/log/php-fpm.log --with-fpm-pid=/usr/local/php-5.2.17/var/run/php-fpm.pid --disable-debug --with-png-dir --with-jpeg-dir --with-gd --with-freetype-dir --with-mcrypt --with-gdbm --with-openssl --with-gettext --with-iconv --with-curl --enable-sockets --with-libdir=lib --with-jpeg-dir=/usr]
  --version           [5.2.17]
  --vernum            [50217]
[root@cky-kvm-1 unit]# 
./configure php --module=php5 \
                  --config=/usr/local/php-5.2.17/bin/php-config  \
                  --lib-path=/usr/local/php-5.2.17/lib
configuring PHP module
checking for PHP ... found
 + PHP SAPI: [embed]
checking for PHP version ... 5.2.17
checking for PHP embed SAPI ... found
checking for PHP Zend Thread Safety ... not found
checking for PHP zend_signal_startup() ... not found
 + PHP module: php5.unit.so

[root@cky-kvm-1 unit]# LANG=c make
cc -c -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g   -Wno-write-strings -I src -I build/include \
-I/usr/local/php-5.2.17/include/php -I/usr/local/php-5.2.17/include/php/main -I/usr/local/php-5.2.17/include/php/TSRM -I/usr/local/php-5.2.17/include/php/Zend -I/usr/local/php-5.2.17/include/php/ext -I/usr/local/php-5.2.17/include/php/ext/date/lib -DNXT_ZEND_SIGNAL_STARTUP=0 \
-MMD -MF build/src/nxt_php_sapi-php5.dep -MT build/src/nxt_php_sapi-php5.o \
-o build/src/nxt_php_sapi-php5.o src/nxt_php_sapi.c
src/nxt_php_sapi.c:170:5: error: 'ZEND_FE_END' undeclared here (not in a function); did you mean 'ZEND_BW_AND'?
  170 |     ZEND_FE_END
      |     ^~~~~~~~~~~
      |     ZEND_BW_AND
src/nxt_php_sapi.c:181:5: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  181 |     nxt_php_ext_functions,       /* function table */
      |     ^~~~~~~~~~~~~~~~~~~~~
In file included from src/nxt_main.h:32,
                 from src/nxt_php_sapi.c:13:
src/nxt_php_sapi.c: In function 'zif_fastcgi_finish_request':
src/nxt_php_sapi.c:229:23: error: implicit declaration of function 'zend_parse_parameters_none'; did you mean 'zend_parse_parameters_ex'? [-Werror=implicit-function-declaration]
  229 |     if (nxt_slow_path(zend_parse_parameters_none() == FAILURE)) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/nxt_clang.h:32:30: note: in definition of macro 'nxt_expect'
   32 |     __builtin_expect((long) (x), (c))
      |                              ^
src/nxt_php_sapi.c:229:9: note: in expansion of macro 'nxt_slow_path'
  229 |     if (nxt_slow_path(zend_parse_parameters_none() == FAILURE)) {
      |         ^~~~~~~~~~~~~
src/nxt_php_sapi.c: At top level:
src/nxt_php_sapi.c:321:5: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion]
  321 |     NULL,                        /* executable_location */
      |     ^~~~
src/nxt_php_sapi.c:321:5: note: (near initialization for 'nxt_php_sapi_module.php_ini_ignore')
src/nxt_php_sapi.c:336:5: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion]
  336 |     NULL,                        /* ini_defaults */
      |     ^~~~
src/nxt_php_sapi.c:336:5: note: (near initialization for 'nxt_php_sapi_module.phpinfo_as_text')
src/nxt_php_sapi.c:339:5: error: excess elements in struct initializer [-Werror]
  339 |     NULL,                        /* ini_entries */
      |     ^~~~
src/nxt_php_sapi.c:339:5: note: (near initialization for 'nxt_php_sapi_module')
src/nxt_php_sapi.c:340:5: error: excess elements in struct initializer [-Werror]
  340 |     NULL,                        /* additional_functions */
      |     ^~~~
src/nxt_php_sapi.c:340:5: note: (near initialization for 'nxt_php_sapi_module')
src/nxt_php_sapi.c:341:5: error: excess elements in struct initializer [-Werror]
  341 |     NULL                         /* input_filter_init */
      |     ^~~~
src/nxt_php_sapi.c:341:5: note: (near initialization for 'nxt_php_sapi_module')
src/nxt_php_sapi.c: In function 'nxt_php_setup':
src/nxt_php_sapi.c:431:42: error: 'ZEND_INI_SYSTEM' undeclared (first use in this function)
  431 |         nxt_php_set_options(task, value, ZEND_INI_SYSTEM);
      |                                          ^~~~~~~~~~~~~~~
src/nxt_php_sapi.c:431:42: note: each undeclared identifier is reported only once for each function it appears in
src/nxt_php_sapi.c:434:42: error: 'ZEND_INI_USER' undeclared (first use in this function); did you mean 'ZEND_INCLUDE'?
  434 |         nxt_php_set_options(task, value, ZEND_INI_USER);
      |                                          ^~~~~~~~~~~~~
      |                                          ZEND_INCLUDE
src/nxt_php_sapi.c: In function 'nxt_php_alter_option':
src/nxt_php_sapi.c:761:5: error: unknown type name 'zend_ini_entry'; did you mean 'zend_end_try'?
  761 |     zend_ini_entry  *ini_entry;
      |     ^~~~~~~~~~~~~~
      |     zend_end_try
src/nxt_php_sapi.c:776:18: error: request for member 'on_modify' in something not a structure or union
  776 |     if (ini_entry->on_modify
      |                  ^~
src/nxt_php_sapi.c:777:21: error: request for member 'on_modify' in something not a structure or union
  777 |         && ini_entry->on_modify(ini_entry, cstr, value->length,
      |                     ^~
src/nxt_php_sapi.c:778:42: error: request for member 'mh_arg1' in something not a structure or union
  778 |                                 ini_entry->mh_arg1, ini_entry->mh_arg2,
      |                                          ^~
src/nxt_php_sapi.c:778:62: error: request for member 'mh_arg2' in something not a structure or union
  778 |                                 ini_entry->mh_arg1, ini_entry->mh_arg2,
      |                                                              ^~
src/nxt_php_sapi.c:779:42: error: request for member 'mh_arg3' in something not a structure or union
  779 |                                 ini_entry->mh_arg3, ZEND_INI_STAGE_ACTIVATE
      |                                          ^~
src/nxt_php_sapi.c:779:53: error: 'ZEND_INI_STAGE_ACTIVATE' undeclared (first use in this function)
  779 |                                 ini_entry->mh_arg3, ZEND_INI_STAGE_ACTIVATE
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
src/nxt_php_sapi.c:787:14: error: request for member 'value' in something not a structure or union
  787 |     ini_entry->value = cstr;
      |              ^~
src/nxt_php_sapi.c:788:14: error: request for member 'value_length' in something not a structure or union
  788 |     ini_entry->value_length = value->length;
      |              ^~
src/nxt_php_sapi.c:789:14: error: request for member 'modifiable' in something not a structure or union
  789 |     ini_entry->modifiable = type;
      |              ^~
src/nxt_php_sapi.c: In function 'nxt_php_dynamic_request':
src/nxt_php_sapi.c:1051:28: error: implicit declaration of function 'memmem'; did you mean 'memset'? [-Werror=implicit-function-declaration]
 1051 |     ctx->path_info.start = memmem(path.start, path.length, ".php/",
      |                            ^~~~~~
      |                            memset
src/nxt_php_sapi.c:1051:26: error: assignment to 'u_char *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
 1051 |     ctx->path_info.start = memmem(path.start, path.length, ".php/",
      |                          ^
src/nxt_php_sapi.c: In function 'nxt_zend_stream_init_fp':
src/nxt_php_sapi.c:1145:22: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
 1145 |     handle->filename = filename;
      |                      ^
src/nxt_php_sapi.c: In function 'nxt_php_hash_str_find_ptr':
src/nxt_php_sapi.c:1579:26: error: passing argument 1 of 'zend_hash_find' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
 1579 |     ret = zend_hash_find(ht, buf, str->length + 1, &entry);
      |                          ^~
In file included from /usr/local/php-5.2.17/include/php/Zend/zend.h:276,
                 from /usr/local/php-5.2.17/include/php/main/php.h:34,
                 from src/nxt_php_sapi.c:7:
/usr/local/php-5.2.17/include/php/Zend/zend_hash.h:156:40: note: expected 'HashTable *' {aka 'struct _hashtable *'} but argument is of type 'const HashTable *' {aka 'const struct _hashtable *'}
  156 | ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
      |                             ~~~~~~~~~~~^~
cc1: all warnings being treated as errors
make: *** [build/Makefile:1894: build/src/nxt_php_sapi-php5.o] Error 1

@ylighgh ylighgh changed the title "ailed to compile custom language module for PHP 5.2.17 with Unit 1.30 Failed to compile custom language module for PHP 5.2.17 with Unit 1.30 Apr 9, 2023
@ac000
Copy link
Member

ac000 commented Apr 10, 2023

Wow, PHP 5.2 is really old!

What system is that, that still has such an old PHP?

We do still support 5.4, not sure if 5.3 works or not.

@rwahowa
Copy link

rwahowa commented Apr 11, 2023

Can't you use a newer version of PHP? If your application requires 5.2 then it is probably an abandoned project, making it a no-go zone.

@ylighgh
Copy link
Author

ylighgh commented Jul 5, 2023

Wow, PHP 5.2 is really old!

What system is that, that still has such an old PHP?

We do still support 5.4, not sure if 5.3 works or not.

Yes, this version of PHP is really old and I am currently planning to upgrade it to PHP8.0

@ylighgh ylighgh closed this as completed Jul 5, 2023
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

4 participants