Skip to content
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

Installation of PHP 8.1 fails #1278

Open
theofidry opened this issue Dec 6, 2022 · 4 comments
Open

Installation of PHP 8.1 fails #1278

theofidry opened this issue Dec 6, 2022 · 4 comments

Comments

@theofidry
Copy link
Contributor

Output

Error: Configure failed: configure: error: unrecognized options: --enable-json

Expected Result

Successful installation.

Command

phpbrew --debug install --stdout \
    8.1 \
    +default \
    +intl=shared,$(brew --prefix icu4c) \
    +mysql \
    +pgsql \
    +openssl="$(brew --prefix openssl@1.1)" \
    +curl="$(brew --prefix curl)" \
    +iconv="$(brew --prefix libiconv)" \
    +bz2="$(brew --prefix bzip2)" \
    +zlib="$(brew --prefix zlib)" \
    +fpm \
    -- \
        --without-pcre-jit \
        --with-sodium \
        --enable-option-checking=fatal

Build Log

command output
===> phpbrew will now build 8.1.13
---> Parsing variants from command arguments '+default +intl=shared,/opt/homebrew/opt/icu4c +mysql +pgsql +openssl=/opt/homebrew/opt/openssl@1.1 +curl=/opt/homebrew/opt/curl +iconv=/opt/homebrew/opt/libiconv +bz2=/opt/homebrew/opt/bzip2 +zlib=/opt/homebrew/opt/zlib +fpm -- --without-pcre-jit --with-sodium --enable-option-checking=fatal'
===> Loading and resolving variants...
Checking distribution checksum...
Checksum matched: 93fcfdfaaa3d094a0fdb18ce08d20f20d526ee3f07a146a8a8ec82ce00b237ca
===> Distribution file was successfully extracted, skipping...
Source Directory: /path/to/user/.phpbrew/build/php-8.1.13
Writing variant info to /path/to/user/.phpbrew/php/php-8.1.13/phpbrew.variants
===> Checking patches...
Checking patch for replace apache php module name with custom version name
Checking patch for replace freetype-config with pkg-config on php older than 7.4
Enabled variants: [intl, mysql, pgsql, openssl, curl, iconv, bz2, zlib, fpm, xml, opcache, bcmath, calendar, cli, ctype, dom, fileinfo, filter, ipc, json, mbregex, mbstring, mhash, pcntl, pcre, pdo, pear, phar, posix, readline, sockets, tokenizer, zip]
Disabled variants: []
===> Configuring 8.1.13...
./configure '--cache-file=/path/to/user/.phpbrew/cache/config.cache' '--prefix=/path/to/user/.phpbrew/php/php-8.1.13' '--with-config-file-path=/path/to/user/.phpbrew/php/php-8.1.13/etc' '--with-config-file-scan-dir=/path/to/user/.phpbrew/php/php-8.1.13/var/db' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--enable-intl' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/tmp/mysql.sock' '--with-pgsql=/opt/homebrew/Cellar/postgresql@14/14.6/bin' '--with-pdo-pgsql=/opt/homebrew/Cellar/postgresql@14/14.6/bin' '--with-openssl' '--with-curl' '--with-iconv=/opt/homebrew/opt/libiconv' '--with-bz2=/opt/homebrew/opt/bzip2' '--with-zlib' '--enable-fpm' '--enable-dom' '--with-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--enable-opcache' '--enable-bcmath' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/opt/homebrew/opt/mhash' '--enable-pcntl' '--enable-pdo' '--with-pear=/path/to/user/.phpbrew/php/php-8.1.13/lib/php/pear' '--enable-posix' '--with-readline=/opt/homebrew/opt/readline' '--enable-sockets' '--with-zip' '--without-pcre-jit' '--with-sodium' '--enable-option-checking=fatal' 'PKG_CONFIG_PATH=/opt/homebrew/opt/icu4c/lib/pkgconfig:/opt/homebrew/opt/openssl@1.1/lib/pkgconfig:/opt/homebrew/opt/curl/lib/pkgconfig:/opt/homebrew/opt/zlib/lib/pkgconfig:/opt/homebrew/opt/libxml2/lib/pkgconfig:/opt/homebrew/opt/oniguruma/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig' 2>&1
configure: error: unrecognized options: --enable-json
Error: Configure failed: configure: error: unrecognized options: --enable-json

Platform

OSX 11.6 M1

$ php --version
PHP 8.1.13 (cli) (built: Nov 24 2022 15:52:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies


$ phpbrew system
/path/to/user/.phpbrew/php/php-7.4.33/bin/php

I believe the culprit is --enable-option-checking=fatal as it works fine without. But IMO it's just a symptom of the problem that PHPBrew adds (not sure where) --enable-json – presumably because of the variant +json. If you try -json it will add --disable-json which will result in the same error.

I came across this page which suggest that the json variant is obsolete from PHP 8.0 onwards. So I would suggest:

  • To add a notice to the user when using the +json or -json explicitly for a PHP8+ installation
  • Ignore the variant when using +default for a PHP8+ installation (i.e. no notice)
  • Do not append the flags for PHP8+
@peter279k
Copy link
Member

peter279k commented Dec 6, 2022

It seems that the --enable-json option will not be found in the ./configure script when compiling the PHP 8.x versions.

The probable reason is: the PHP 8.x version always includes the json extension and the above option is removed.

@peter279k
Copy link
Member

Using the following steps to verify and reproduce the issue in the Ubuntu 20.04:

$ phpbrew --debug install 8.0 +default -- --enable-option-checking=fatal
===> phpbrew will now build 8.0.26
---> Parsing variants from command arguments '+default -- --enable-option-checking=fatal'
===> Loading and resolving variants...
Downloading https://www.php.net/distributions/php-8.0.26.tar.bz2 via php stream
https://www.php.net/distributions/php-8.0.26.tar.bz2 => /root/.phpbrew/distfiles/php-8.0.26.tar.bz2
===> Extracting /root/.phpbrew/distfiles/php-8.0.26.tar.bz2 to /root/.phpbrew/build/tmp.1670324964/php-8.0.26
===> Moving /root/.phpbrew/build/tmp.1670324964/php-8.0.26 to /root/.phpbrew/build/php-8.0.26
Source Directory: /root/.phpbrew/build/php-8.0.26
Writing variant info to /root/.phpbrew/php/php-8.0.26/phpbrew.variants
===> Checking patches...
Checking patch for replace apache php module name with custom version name
Checking patch for replace freetype-config with pkg-config on php older than 7.4
Enabled variants: [xml, opcache, bcmath, bz2, calendar, cli, ctype, dom, fileinfo, filter, ipc, json, mbregex, mbstring, mhash, pcntl, pcre, pdo, pear, phar, posix, readline, sockets, tokenizer, curl, openssl, zip]
Disabled variants: []
===> Configuring 8.0.26...


Use tail command to see what's going on:
   $ tail -F '/root/.phpbrew/build/php-8.0.26/build.log'


./configure '--cache-file=/root/.phpbrew/cache/config.cache' '--prefix=/root/.phpbrew/php/php-8.0.26' '--with-config-file-path=/root/.phpbrew/php/php-8.0.26/etc' '--with-config-file-scan-dir=/root/.phpbrew/php/php-8.0.26/var/db' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-dom' '--with-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--enable-opcache' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash' '--enable-pcntl' '--enable-pdo' '--with-pear=/root/.phpbrew/php/php-8.0.26/lib/php/pear' '--enable-posix' '--with-readline=/usr' '--enable-sockets' '--with-curl' '--with-openssl' '--with-zip' '--enable-option-checking=fatal' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig' >> '/root/.phpbrew/build/php-8.0.26/build.log' 2>&1
Error: Configure failed:
The last 5 lines in the log file:
configure: error: unrecognized options: --enable-json

Please checkout the build log file for more details:
         tail /root/.phpbrew/build/php-8.0.26/build.log

@eyeskiller
Copy link

Any solution to this?

@theofidry
Copy link
Contributor Author

The workaround is to not use --enable-option-checking=fatal

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

3 participants