Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: bonbob on November 10, 2018, 08:36:29 AM

Title: Sync support in PHP7
Post by: bonbob on November 10, 2018, 08:36:29 AM
Is it possible add an Sync support to php7 extension pack?
read more about Sync: http://php.net/manual/en/book.sync.php (http://php.net/manual/en/book.sync.php)
Title: Re: Sync support in PHP7
Post by: andyj on November 10, 2018, 04:59:28 PM
This is not part of the standard PHP source distribution. I have compiled it as a separate extension for 9.x 64-bit (you didn't specify version or arch). It loads on my test system, but I do not have any PHP code to test it. Can you supply some test cases?
Title: Re: Sync support in PHP7
Post by: bonbob on November 11, 2018, 11:46:13 AM
I'll test it, but now i run 32-bit version TinyCore on my server.
Title: Re: Sync support in PHP7
Post by: andyj on November 13, 2018, 08:31:19 AM
The php7-pecl-sync.tcz extension for both 32-bit and 64-bit is in the repository now. I would still like to see some use/test cases.
Title: Re: Sync support in PHP7
Post by: bonbob on November 13, 2018, 02:01:33 PM
I have installed extension for 32-bit version, restart php7-fpm server but extension not appear:
Code: [Select]
PHP Fatal error:  Uncaught Error: Class 'SyncEvent' not found in...
Title: Re: Sync support in PHP7
Post by: andyj on November 13, 2018, 02:35:27 PM
Is this when PHP starts, or when you try to use one of the sync functions? Can you post the rest of the message? If it's a PHP script, can you post that too?
Title: Re: Sync support in PHP7
Post by: bonbob on November 14, 2018, 02:03:13 PM
It appeares when i run script with Simple Example from php.net
Code: [Select]
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
Title: Re: Sync support in PHP7
Post by: andyj on November 14, 2018, 03:19:25 PM
Using this:

Code: [Select]
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
var_dump($event);

I get this:

Code: [Select]
object(SyncEvent)#1 (0) { }

You did remember to add the extension to your php.ini file? It won't load automagically, because I wasn't clever enough at the time I cobbled the tcz together to include an /usr/local/etc/php7/extensions/sync.ini file with it. Maybe I'll remember if I rebuild it for PHP 7.3.
Title: Re: Sync support in PHP7
Post by: bonbob on November 15, 2018, 11:58:07 AM
You did remember to add the extension to your php.ini file? It won't load automagically

Yep! I added extension=sync.so to php.ini and sync support has appeared. Thanks!