WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Sync support in PHP7  (Read 3225 times)

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Sync support in PHP7
« 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

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Sync support in PHP7
« Reply #1 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?

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Sync support in PHP7
« Reply #2 on: November 11, 2018, 11:46:13 AM »
I'll test it, but now i run 32-bit version TinyCore on my server.

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Sync support in PHP7
« Reply #3 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.

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Sync support in PHP7
« Reply #4 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...

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Sync support in PHP7
« Reply #5 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?

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Sync support in PHP7
« Reply #6 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();

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Sync support in PHP7
« Reply #7 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.

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Sync support in PHP7
« Reply #8 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!