-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hello,
I've been studying how to operate Raspberry Pi using PHP recently. The model I'm working with is 3b, and the operating system is almalinux 9. I've looked into many libraries and found that most of them operate on /sys/class/gpio. After comparing, I believe your library has the most comprehensive functionality and better performance. However, I've encountered some issues while using it. These issues involve low-level operations of the operating system, and my understanding of the system is insufficient to resolve them. Therefore, I'm seeking your help.
I've noticed that your library hasn't been updated for quite some time. There are some deprecated syntax warnings when using PHP 8.1, but I've made modifications to address these issues, and they have been resolved.
The current issue lies with mmap. When using the Python script method, I encounter the following errors:
Traceback (most recent call last):
File "/var/www/6002/calcinai/vendor/calcinai/php-mmap/lib/MMap/../../subprocess/mmap-proxy.py", line 19, in <module>
address = struct.unpack('<H', sys.stdin.read(2))[0];
TypeError: a bytes-like object is required, not 'str'
I attempted to compile your https://github.com/calcinai/php-ext-mmap, but it also resulted in an error:
┌─[root@alma9-v4-2-12-4] - [/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap] - [2024-03-30 12:00:00]
└─[0] <> make install
/bin/sh /var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/libtool --mode=compile cc -I. -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/include -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/main -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/mmap.c -o mmap.lo
libtool: compile: cc -I. -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/include -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/main -I/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/mmap.c -fPIC -DPIC -o .libs/mmap.o
In file included from /var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/mmap.c:5:
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/php_mmap.h:11:80: error: expected ‘;’, ‘,’ or ‘)’ before ‘TSRMLS_DC’
11 | size_t mmap_stream_write(php_stream *stream, const char *buffer, size_t length TSRMLS_DC); size_t mmap_stream_read(php_stream *stream, char *buffer, size_t length TSRMLS_DC); int mmap_stream_flush(php_stream *stream TSRMLS_DC); int mmap_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset);
| ^~~~~~~~~
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/php_mmap.h:12:73: error: expected ‘;’, ‘,’ or ‘)’ before ‘TSRMLS_DC’
12 | int mmap_stream_close(php_stream *stream, int close_handle TSRMLS_DC);
| ^
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/php_mmap.h:13:42: error: expected ‘;’, ‘,’ or ‘)’ before ‘TSRMLS_DC’
13 |
| ^
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/php_mmap.h:15:72: error: expected ‘;’, ‘,’ or ‘)’ before ‘TSRMLS_DC’
15 | void *base_offset; void *current_offset; int length; };
| ^
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/mmap.c:39:5: error: ‘mmap_stream_write’ undeclared here (not in a function); did you mean ‘_php_stream_write’?
39 | mmap_stream_write,
| ^~~~~~~~~~~~~~~~~
| _php_stream_write
/var/www/6025/componentsTest/gpio/mmap/php-ext-mmap/mmap.c:40:5: error: ‘mmap_stream_read’ undeclared here (not in a function); did you mean ‘mmap_stream_seek’?
40 | mmap_stream_read,
| ^~~~~~~~~~~~~~~~
| mmap_stream_seek
So I'm not sure if you have the energy and time, but if possible, could you compile php-ext-mmap into an SO file and include it in the release, compatible with PHP 8.1 to 8.2?
appreciate it!