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

Upgrade from PHP 7.4 to PHP 8 #106

Closed
mindaugasvcs opened this issue Jan 13, 2022 · 9 comments
Closed

Upgrade from PHP 7.4 to PHP 8 #106

mindaugasvcs opened this issue Jan 13, 2022 · 9 comments
Assignees
Labels

Comments

@mindaugasvcs
Copy link

Hi,
After upgrade from PHP 7.4 to PHP 8.0 I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library 'uv.so' (tried: /usr/lib64/php/modules/uv.so (/usr/lib64/php/modules/uv.so: undefined symbol: zend_internal_type_error), /usr/lib64/php/modules/uv.so.so (/usr/lib64/php/modules/uv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

ATTENTION! uv.so library file is in the /usr/lib64/php/modules directory!

@kelunik
Copy link
Member

kelunik commented Jan 13, 2022

You need to install the extension for PHP 8 as well, you can't simply use the same .so file. The extension is running fine on PHP 8.1.

@mindaugasvcs
Copy link
Author

mindaugasvcs commented Jan 13, 2022

Can you shed some light on installing this almost non-existent php extension on CentOS 8? I tried to compile it from source with no success.
git clone https://github.com/bwoebi/php-uv.git
cd php-uv
phpize
./configure -> this step fails, version conflict.
make
make install

checking for libuv... checking for uv_version in -luv... no
configure: error: wrong uv library version or library not found

Installed Packages
Name : libuv
Epoch : 1
Version : 1.41.1
Release : 1.el8_4
Architecture : x86_64
Size : 396 k
Source : libuv-1.41.1-1.el8_4.src.rpm
Repository : @System
From repo : appstream
Summary : libuv is a multi-platform support library with a focus on asynchronous I/O.
URL : http://libuv.org/
License : MIT and BSD and ISC
Description : libuv is a multi-platform support library with a focus on asynchronous I/O

@mindaugasvcs
Copy link
Author

Well, I managed to install this extension for PHP 8, but something is still not quite right..

At least in README.md file you could mention that libuv-devel needs to be installed on target OS to compile and install this extension. On CentOS 8 in /etc/yum.repos.d/CentOS-Linux-PowerTools.repo config file enabled must be 1.

@kelunik
Copy link
Member

kelunik commented Jan 13, 2022

Feel free to open a PR with instructions. The package name will be different for different distributions, e.g. Ubuntu uses libuv-dev IIRC.

Could you shed some more light on what doesn't seem right?

@kelunik kelunik self-assigned this Jan 13, 2022
@kelunik kelunik changed the title This thing does not work with PHP 8 Upgrade from PHP 7.4 to PHP 8 Jan 13, 2022
@mindaugasvcs
Copy link
Author

mindaugasvcs commented Jan 13, 2022

In this version I get error:
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function x{closure}(), 2 passed and exactly 3 expected in x.php:577

It says uv_read_start function's second parameter is a callback/closure but the callback/closure only gets 2 args, when 3 args expected when called :/

Did not have any problems before.

@mindaugasvcs
Copy link
Author

In original libuv documentation this callback is described as:
typedef void (*uv_read_cb)(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)

buf is a pointer, sometimes invalid so in PHP it should be set to NULL but not skipped entirely.

@kelunik
Copy link
Member

kelunik commented Jan 13, 2022

I guess you've used 0.2.x before, and you're using the master branch now, which contains some BC breaks.

@mindaugasvcs
Copy link
Author

Very nice to find this out. Only a minor version change in this extension have already introduced breaking changes.
May I know the reasons of such changes? Maybe you are planning to release your own documentation?

Something tells me I should have migrated to node.js long time ago, as before, PHP is meant just for Wordpress style web pages. Nothing has really changed :/

@kelunik
Copy link
Member

kelunik commented Jan 13, 2022

The master branch is an unreleased version which is planned to be released as 0.3.0 eventually. For 0.x releases, x is usually considered the major version instead of a minor version.

I'm not sure why this has been changed or what changed. You're free to research that yourself if you want to use an unreleased version. We usually provide changelogs for releases only.

That said, we're actively using the unreleased version, too, but only what's necessary to build libraries in the @amphp organization. I can only recommend to use amphp/byte-stream instead of using ext-uv directly.

We might even consider removing parts of ext-uv that aren't necessary for our purposes in the future, so maintenance becomes easier, as the scope is reduced.

@kelunik kelunik closed this as completed Jan 13, 2022
TheTechsTech added a commit to symplely/ext-uv that referenced this issue Mar 30, 2023
**In reference to:** amphp#106, amphp#107, amphp#94, amphp#98, amphp#93, amphp#92, amphp#86, amphp#84, amphp#82, amphp#64

- BC signature changes has been revert since some of the tests wasn't changed to match, and too far off original design.
- Using current **Libuv** version or systems installed one, not `pecl`, this setup is not reliant on the really slow `pecl` system for updated installations.

The whole `uv_queue_work()` will need to be re implemented, the core internal `TSRM.c` thread related `tsrm_***_interpreter_context` functions used in PHP 7.4 has been removed since PHP 8.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants