davidcole1340 / ext-php-rs

Bindings for the Zend API to build PHP extensions natively in Rust.
Apache License 2.0
598 stars 64 forks source link

Module and PHP versions need to match #306

Closed shdblowers closed 9 months ago

shdblowers commented 10 months ago

Hi, running through the hello world tutorial in the docs, I get an error in the following step:

$ php -d extension=./target/debug/libhello_world_php_rs.so test.php
PHP Warning:  PHP Startup: hello_world_php_rs: Unable to initialize module
Module compiled with module API=20220829
PHP    compiled with module API=20230831
These options need to match
 in Unknown on line 0
PHP Fatal error:  Uncaught Error: Call to undefined function hello_world() in /home/steven/sandbox/hello_world_php_rs/test.php:3
Stack trace:
#0 {main}
  thrown in /home/steven/sandbox/hello_world_php_rs/test.php on line 3

This is the version I'm running:

$ php -v                                                           
PHP 8.3.0 (cli) (built: Nov 24 2023 08:50:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies
    with Xdebug v3.3.0, Copyright (c) 2002-2023, by Derick Rethans

$ rustc -V
rustc 1.74.1 (a28077b28 2023-12-04)
danog commented 10 months ago

Make sure you've installed the correct version of the php development dependencies.