oerdnj / deb.sury.org

Public bugreports for anything ppa:ondrej/*
825 stars 26 forks source link

Can not instantiate http\Client on Ubuntu 18.04 with php5.6-http #1638

Open nagyt234 opened 3 years ago

nagyt234 commented 3 years ago

The simple php program which instantiates http\Client generates an exception on Ubuntu 18:

$ cat /tmp/test.php
<?php
      $client = new \http\Client;

$ php /tmp/test.php
PHP Fatal error:  Uncaught exception 'http\Exception\UnexpectedValueException' with message 'Failed to locate "(null)" client request handler' in /tmp/test.php:2
Stack trace:
#0 /tmp/test.php(2): http\Client->__construct()
#1 {main}
  thrown in /tmp/test.php on line 2

PHP version:

$ php -v
PHP 5.6.40-53+ubuntu18.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Installed php and curl packages:

$ dpkg --get-selections | egrep 'php|curl'
libapache2-mod-php5.6                           install
libcurl3:amd64                                  install
libcurl3-gnutls:amd64                           install
php-common                                      install
php-pear                                        install
php5.6                                          install
php5.6-cli                                      install
php5.6-common                                   install
php5.6-dev                                      install
php5.6-http                                     install
php5.6-json                                     install
php5.6-mbstring                                 install
php5.6-mysql                                    install
php5.6-opcache                                  install
php5.6-propro                                   install
php5.6-raphf                                    install
php5.6-readline                                 install
php5.6-xml                                      install
pkg-php-tools                                   install

Any idea?

sleemanj commented 3 years ago

Sounds like related to https://github.com/oerdnj/deb.sury.org/issues/1442

oerdnj commented 3 years ago

Folks, you need to stop using PHP versions that reached End-Of-Life years ago and still expect that everything would work and bugs will get fixed. They won't, this is just legacy.

Any idea?

Upgrade your code to PHP 8.0.

nagyt234 commented 3 years ago

@oerdnj You are absolutely right. The problem is, that I have to run a legacy system, which works on Ubuntu 16 with PHP 5.6 without any problem, but the operating system must be a supported system because of the company's security policy, so I can not use Ubuntu 16 anymore.

oerdnj commented 3 years ago

My only recommendation here would be to try to compile the raphf, propro and pecl_http extensions by hand and see whether you can find a combination of versions that does work.