Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
155 views
in Technique[技术] by (71.8m points)

c - PECL PCSC install on PHP 7.4

I am using PHP code that relies on the package: https://pecl.php.net/package/pcsc

Finally I need to update from PHP 5 to PHP 7 (late enough). The REMI repo for CentOS unfortunately does not support PCSC for PHP7 anymore so I tried to install it manually by using the command:

pecl install channel://pecl.php.net/pcsc-0.3.1

But I get a bunch of errors (see below). Is there a way to solve this? Is there an alternative to access smart cards in PHP (did not find any)?

Errors:

/var/tmp/pcsc/pcsc.c:92:35: error: unknown type name 'zend_rsrc_list_entry' static void php_pcsc_ctx_res_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {

/var/tmp/pcsc/pcsc.c:113:36: error: unknown type name 'zend_rsrc_list_entry' static void php_pcsc_conn_res_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {

/var/tmp/pcsc/pcsc.c: In function 'zm_startup_pcsc': /var/tmp/pcsc/pcsc.c:272:53: error: 'php_pcsc_ctx_res_dtor' undeclared (first use in this function)
le_pcsc_ctx_res=zend_register_list_destructors_ex(php_pcsc_ctx_res_dtor, NULL, PHP_PCSC_CTX_RES_NAME,module_number);

/var/tmp/pcsc/pcsc.c:272:53: note: each undeclared identifier is reported only once for each function it appears in /var/tmp/pcsc/pcsc.c:273:54: error: 'php_pcsc_conn_res_dtor' undeclared (first use in this function)
le_pcsc_conn_res=zend_register_list_destructors_ex(php_pcsc_conn_res_dtor, NULL, PHP_PCSC_CONN_RES_NAME,module_number);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_is_valid_context': /var/tmp/pcsc/pcsc.c:521:31: error: expected expression before 'SCARDCONTEXT'
ZEND_FETCH_RESOURCE(context,SCARDCONTEXT,&ctx_res,-1,PHP_PCSC_CTX_RES_NAME,le_pcsc_ctx_res);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_release_context': /var/tmp/pcsc/pcsc.c:543:31: error: expected expression before 'SCARDCONTEXT'
ZEND_FETCH_RESOURCE(context,SCARDCONTEXT,&ctx_res,-1,PHP_PCSC_CTX_RES_NAME,le_pcsc_ctx_res);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_list_readers': /var/tmp/pcsc/pcsc.c:564:31: error: expected expression before 'SCARDCONTEXT'
ZEND_FETCH_RESOURCE(context,SCARDCONTEXT,&ctx_res,-1,PHP_PCSC_CTX_RES_NAME,le_pcsc_ctx_res);

/var/tmp/pcsc/pcsc.c:580:5: error: too many arguments to function 'add_next_index_string' add_next_index_string(return_value, ptrReader, TRUE);

In file included from /usr/include/php/main/php.h:37:0, from /var/tmp/pcsc/pcsc.c:23: /usr/include/php/Zend/zend_API.h:432:14: note: declared here ZEND_API int add_next_index_string(zval *arg, const char *str);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_connect': /var/tmp/pcsc/pcsc.c:609:31: error: expected expression before 'SCARDCONTEXT'
ZEND_FETCH_RESOURCE(context,SCARDCONTEXT,&ctx_res,-1,PHP_PCSC_CTX_RES_NAME,le_pcsc_ctx_res);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_disconnect': /var/tmp/pcsc/pcsc.c:634:29: error: expected expression before 'SCARDHANDLE'
ZEND_FETCH_RESOURCE(hCard,SCARDHANDLE,&conn_res,-1,PHP_PCSC_CONN_RES_NAME,le_pcsc_conn_res);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_transmit': /var/tmp/pcsc/pcsc.c:665:29: error: expected expression before 'SCARDHANDLE'
ZEND_FETCH_RESOURCE(hCard,SCARDHANDLE,&conn_res,-1,PHP_PCSC_CONN_RES_NAME,le_pcsc_conn_res);

/var/tmp/pcsc/pcsc.c:708:58: error: macro "RETVAL_STRING" passed 2 arguments, but takes just 1
RETVAL_STRING(e_bytes_to_hex(recvBuffer, recvLen), TRUE);

/var/tmp/pcsc/pcsc.c:708:3: error: 'RETVAL_STRING' undeclared (first use in this function) RETVAL_STRING(e_bytes_to_hex(recvBuffer, recvLen), TRUE);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_status': /var/tmp/pcsc/pcsc.c:731:29: error: expected expression before 'SCARDHANDLE'
ZEND_FETCH_RESOURCE(hCard,SCARDHANDLE,&conn_res,-1,PHP_PCSC_CONN_RES_NAME,le_pcsc_conn_res);

/var/tmp/pcsc/pcsc.c:763:85: error: macro "add_assoc_string" passed 4 arguments, but takes just 3 add_assoc_string(return_value, "PROTOCOL", "RAW", TRUE);

/var/tmp/pcsc/pcsc.c:763:31: error: 'add_assoc_string' undeclared (first use in this function) add_assoc_string(return_value, "PROTOCOL", "RAW", TRUE);

/var/tmp/pcsc/pcsc.c:766:85: error: macro "add_assoc_string" passed 4 arguments, but takes just 3 add_assoc_string(return_value, "PROTOCOL", "T=0", TRUE);

/var/tmp/pcsc/pcsc.c:769:85: error: macro "add_assoc_string" passed 4 arguments, but takes just 3 add_assoc_string(return_value, "PROTOCOL", "T=1", TRUE);

/var/tmp/pcsc/pcsc.c:777:58: error: macro "add_assoc_string" passed 4 arguments, but takes just 3 add_assoc_string(return_value, "ATR", atrString, TRUE);

/var/tmp/pcsc/pcsc.c: In function 'zif_scard_errstr': /var/tmp/pcsc/pcsc.c:799:53: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1
RETURN_STRING(php_pcsc_error_to_string(in_errno),1);

/var/tmp/pcsc/pcsc.c:799:3: error: 'RETURN_STRING' undeclared (first use in this function)
RETURN_STRING(php_pcsc_error_to_string(in_errno),1);

make: *** [pcsc.lo] Fehler 1 ERROR: `make' failed

question from:https://stackoverflow.com/questions/65862700/pecl-pcsc-install-on-php-7-4

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally I need to update from PHP 5 to PHP 7 (late enough). The REMI repo for CentOS unfortunately does not support PCSC for PHP7 anymore so I tried to install it manually by using the command:

If the extension was compatible, it would be in the repository, as all other extensions

So this looks as a dead project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...