skip to Main Content

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

2

Answers


  1. 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.

    Login or Signup to reply.
  2. I am the developer of this extension and it is up to date since some weeks.

    Just install it using the following command:

    pecl install pcsc-beta

    You can also get the code from https://github.com/pcsc-for-php/pcsc and compile yourself. You will find instructions on the GitHub page.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search