kjdev / php-ext-brotli

Brotli Extension for PHP
MIT License
176 stars 29 forks source link

Successful installation, Failed Execution #20

Open jabcreations opened 5 years ago

jabcreations commented 5 years ago

Using PuTTY I ran the following:

git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
cd php-ext-brotli
phpize
./configure
make
make install

Tried running the code in PHP:

echo brotli_compress('<p>test 1</p>');

Fatal error: Uncaught Error: Call to undefined function brotli_compress()

So the tests all failed and I'm just posting this here:

$ make test /bin/sh /root/php-ext-brotli/libtool --mode=install cp ./brotli.la /root/php-ext-brotli/modules cp ./.libs/brotli.so /root/php-ext-brotli/modules/brotli.so cp ./.libs/brotli.lai /root/php-ext-brotli/modules/brotli.la PATH="$PATH:/sbin" ldconfig -n /root/php-ext-brotli/modules

Libraries have been installed in: /root/php-ext-brotli/modules

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

  • add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution
  • add LIBDIR to the `LD_RUN_PATH' environment variable during linking
  • use the `-Wl,--rpath -Wl,LIBDIR' linker flag
  • have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.

Build complete. Don't forget to run 'make test'.

===================================================================== PHP : /usr/local/bin/php Warning: PHP Startup: brotli: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20160303 These options need to match in Unknown on line 0

PHP_SAPI : cli PHP_VERSION : 7.1.27 ZEND_VERSION: 3.1.0 PHP_OS : Linux - Linux server.jabcreations.com 2.6.32-042stab120.19 #1 SMP Mon Feb 20 20:05:53 MSK 2017 x86_64 INI actual : /root/php-ext-brotli/tmp-php.ini More .INIs : CWD : /root/php-ext-brotli Extra dirs : VALGRIND : Not used

TIME START 2019-04-01 21:23:14

SKIP Test compatibility [tests/compatibility.phpt] SKIP Test phpinfo() displays brotli info [tests/info.phpt] SKIP brotli.output_compression [tests/ob_001.phpt] reason: CGI not available FAIL brotli.output_compression [tests/ob_002.phpt] SKIP brotli.output_compression [tests/ob_003.phpt] reason: CGI not available SKIP ob_brotli_handler [tests/ob_004.phpt] reason: CGI not available SKIP ob_brotli_handler [tests/ob_005.phpt] reason: CGI not available FAIL brotli.output_compression=1 with client not accepting compression [tests/ob_006.phpt] SKIP brotli.output_compression Overwrites Vary Header [tests/ob_007.phpt] reason: CGI not available SKIP ob_brotli_handler always conflicts with brotli.output_compression [tests/ob_008.phpt] reason: CGI not available SKIP checks brotli compression output size is always the same [tests/ob_009.phpt] FAIL brotli.output_compression ob_get_clean [tests/ob_010.phpt] SKIP ob_brotli_handler [tests/ob_011.phpt] reason: CGI not available SKIP Test roundtrip [tests/roundtrip.phpt]

TIME END 2019-04-01 21:23:15

===================================================================== TEST RESULT SUMMARY

Exts skipped : 0 Exts tested : 14

Number of tests : 14 3 Tests skipped : 11 ( 78.6%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 3 ( 21.4%) (100.0%) Expected fail : 0 ( 0.0%) ( 0.0%) Tests passed : 0 ( 0.0%) ( 0.0%)

Time taken : 1 seconds

===================================================================== FAILED TEST SUMMARY

brotli.output_compression [tests/ob_002.phpt] brotli.output_compression=1 with client not accepting compression [tests/ob_006.phpt] brotli.output_compression ob_get_clean [tests/ob_010.phpt]

You may have found a problem in PHP. This report can be automatically sent to the PHP QA team at http://qa.php.net/reports and http://news.php.net/php.qa.reports This gives us a better understanding of PHP's behavior. If you don't want to send the report immediately you can choose option "s" to save it. You can then email it to qa-reports@lists.php.net later. Do you want to send this report now? [Yns]: Yes

kjdev commented 5 years ago
brotli.output_compression [tests/ob_002.phpt]
brotli.output_compression=1 with client not accepting compression [tests/ob_006.phpt]
brotli.output_compression ob_get_clean [tests/ob_010.phpt]

Do you know the content of the failed log in the test?

Probably the module can not be read properly.

jabcreations commented 5 years ago

I'm not sure what you specifically want me to do? I'm not exactly a Linux guru.

$ brotli.output_compression [tests/ob_002.phpt] -bash: brotli.output_compression: command not found

kjdev commented 5 years ago

The following file will not be generated in the tests directory after running make test. Files with extension out or log.

jabcreations commented 5 years ago

...so? I'm happy to help and am looking for an actionable request that I can understand. I program PHP well enough though I'm not a Linux guru. Are you asking if those files were created / would like me to post their content in example?

kjdev commented 5 years ago

If the test fails, a result file is generated and remains.

$ cd php-ext-brotli
$ ls tests/ob_002.*
tests/ob_002.phpt
$ phpize && ./configure && make
$ make test
..
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
brotli.output_compression [tests/ob_002.phpt]
=====================================================================
$ ls tests/ob_002.*
tests/ob_002.diff  tests/ob_002.log  tests/ob_002.php   tests/ob_002.sh
tests/ob_002.exp   tests/ob_002.out  tests/ob_002.phpt
$ cat tests/ob_002.log # What you want
$ cat tests/ob_002.out # What you want
jabcreations commented 5 years ago

I hope this helps?

[user@server:/root]$ cd php-ext-brotli [user@server:php-ext-brotli]$ ls tests/ob_002. tests/ob_002.diff tests/ob_002.log tests/ob_002.php tests/ob_002.sh tests/ob_002.exp tests/ob_002.out tests/ob_002.phpt [user@server:php-ext-brotli]$ tests/ob_002.phpt -bash: tests/ob_002.phpt: Permission denied [user@server:php-ext-brotli]$ phpize && ./configure && make Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr/local checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/m ain -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/inc lude/php/ext -I/usr/local/include/php/ext/date/lib checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-n on-zts-20131226 checking for PHP installed headers prefix... /usr/local/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... re2c checking for re2c version... invalid configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking PHP version... 50629 checking whether to enable brotli support... yes, shared checking whether to use system brotli library... no checking for brotli... use bundled copy checking for ld used by cc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognize dependent libraries... pass_all checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 1966080 checking command to parse /usr/bin/nm -B output from cc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if cc supports -fno-rtti -fno-exceptions... no checking for cc option to produce PIC... -fPIC checking if cc PIC flag -fPIC works... yes checking if cc static flag -static works... yes checking if cc supports -c -o file.o... yes checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libra ries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no

creating libtool appending configuration tag "CXX" to libtool configure: creating ./config.status config.status: creating config.h config.status: config.h is unchanged

Build complete. Don't forget to run 'make test'.

[user@server:php-ext-brotli]$ make test

Build complete. Don't forget to run 'make test'.

===================================================================== PHP : /usr/local/bin/php Warning: PHP Startup: brotli: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20160303 These options need to match in Unknown on line 0

PHP_SAPI : cli PHP_VERSION : 7.1.27 ZEND_VERSION: 3.1.0 PHP_OS : Linux - Linux server.jabcreations.com 2.6.32-042stab120.19 #1 SMP Mon Feb 20 20:05:53 MSK 2017 x86_64 INI actual : /root/php-ext-brotli/tmp-php.ini More .INIs : CWD : /root/php-ext-brotli Extra dirs : VALGRIND : Not used

TIME START 2019-04-02 00:06:23

SKIP Test compatibility [tests/compatibility.phpt] SKIP Test phpinfo() displays brotli info [tests/info.phpt] SKIP brotli.output_compression [tests/ob_001.phpt] reason: CGI not available FAIL brotli.output_compression [tests/ob_002.phpt] SKIP brotli.output_compression [tests/ob_003.phpt] reason: CGI not available SKIP ob_brotli_handler [tests/ob_004.phpt] reason: CGI not available SKIP ob_brotli_handler [tests/ob_005.phpt] reason: CGI not available FAIL brotli.output_compression=1 with client not accepting compression [tests/ob_006.phpt] SKIP brotli.output_compression Overwrites Vary Header [tests/ob_007.phpt] reason: CGI not available SKIP ob_brotli_handler always conflicts with brotli.output_compression [tests/ob_008.phpt] reason: CGI not available SKIP checks brotli compression output size is always the same [tests/ob_009.phpt] FAIL brotli.output_compression ob_get_clean [tests/ob_010.phpt] SKIP ob_brotli_handler [tests/ob_011.phpt] reason: CGI not available SKIP Test roundtrip [tests/roundtrip.phpt]

TIME END 2019-04-02 00:06:24

===================================================================== TEST RESULT SUMMARY

Exts skipped : 0 Exts tested : 14

Number of tests : 14 3 Tests skipped : 11 ( 78.6%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 3 ( 21.4%) (100.0%) Expected fail : 0 ( 0.0%) ( 0.0%) Tests passed : 0 ( 0.0%) ( 0.0%)

Time taken : 1 seconds

===================================================================== FAILED TEST SUMMARY

brotli.output_compression [tests/ob_002.phpt] brotli.output_compression=1 with client not accepting compression [tests/ob_006.phpt] brotli.output_compression ob_get_clean [tests/ob_010.phpt]

You may have found a problem in PHP. This report can be automatically sent to the PHP QA team at http://qa.php.net/reports and http://news.php.net/php.qa.reports This gives us a better understanding of PHP's behavior. If you don't want to send the report immediately you can choose option "s" to save it. You can then email it to qa-reports@lists.php.net later. Do you want to send this report now? [Yns]:

jabcreations commented 5 years ago

Okay, working on it...

$ ls ./ ob_002.exp ob_004.phpt ob_006.phpt ob_010.log ../ ob_002.log ob_005.phpt ob_006.sh ob_010.out compatibility.phpt ob_002.out ob_006.diff ob_007.phpt ob_010.php files.inc ob_002.php ob_006.exp ob_008.phpt ob_010.phpt info.phpt ob_002.phpt ob_006.log ob_009.phpt ob_010.sh ob_001.phpt ob_002.sh* ob_006.out ob_010.diff ob_011.phpt ob_002.diff ob_003.phpt ob_006.php ob_010.exp roundtrip.phpt

kjdev commented 5 years ago
[user@server:php-ext-brotli]$ make test

Build complete.
Don't forget to run 'make test'.

=====================================================================
PHP : /usr/local/bin/php
Warning: PHP Startup: brotli: Unable to initialize module
Module compiled with module API=20131226
PHP compiled with module API=20160303
These options need to match
in Unknown on line 0

There seems to be a difference between PHP and module versions.

Module compiled with module API=20131226 PHP compiled with module API=20160303

It does not work properly unless it is the same.

jabcreations commented 5 years ago

Sent the email.

jabcreations commented 5 years ago

Why wouldn't it work on a newer version? Hasn't this extension been out for a while?

Sent the email though it bounced.

Sorry, only subscribers may post. If you are a subscriber, please forward this message

Warning: PHP Startup: brotli: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20160303 These options need to match in Unknown on line 0 end DONE

kjdev commented 5 years ago

Please check if the version of phpize, /usr/local/bin/php is the same.

$ phpize --version
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
$ /usr/local/bin/php -i | grep 'PHP API' -A 2
PHP API => 20170718
PHP Extension => 20170718
Zend Extension => 320170718
jabcreations commented 5 years ago

$ phpize --version Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226

$ /usr/local/bin/php -i | grep 'PHP API' -A 2 -bash: $: command not found

kjdev commented 5 years ago

-bash: $: command not found ??

Find the following string from /usr/local/bin/php -i .

PHP API => .xxx
PHP Extension => xxx
Zend Extension => xxx
jabcreations commented 5 years ago

PHP Info:

PHP API 20160303 PHP Extension 20160303 Zend Extension 320160303 Zend Extension Build API320160303,NTS

kjdev commented 5 years ago

$ phpize --version Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226

Please replace the phpize version with the /usr/local/bin/php version and try again.

jabcreations commented 5 years ago

Could you please clarify with details please? I'll clarify that the server allows running multiple versions of PHP and I use the latest version 7.1.x that WHM allows.

kjdev commented 5 years ago
PHP Version PHP Extension Zend Extension
PHP 5.6 20131226 20131226
PHP 7.1 20160303 20160303

Since phpize is from PHP 5.6, modules built with this can only be used with PHP 5.6. Modules that can be used with PHP 7.1 must be built using PHP 7.1's phpize. Where's PHP7.1's phpize depends on the system.

Since /usr/local/bin/php is like PHP 7.1, it will not be in /usr/local/bin etc.