I have freeswitch running on a Centos 6 remote server and I have XAMPP installed on the local machine ( windows 7 x64 PHP Version 5.3.8 ) for testing. I am trying to use Mod event socket ( http://wiki.freeswitch.org/wiki/Event_Socket ) to connect to freeswitch from a php script, using Event Socket Library ( http://wiki.freeswitch.org/wiki/Event_Socket_Library ).
My php script is:
#!/usr/bin/php
<?php
require_once('ESL.php');
$command = "show channels";
$sock = new ESLconnection('xxx.xxx.xxx.xxx', '8021', 'fsAdmin');
$res = $sock->api($command);
printf("%s\n", $res->getBody());
?>
where xxx.xxx.xxx.xxx is the freeswitch server's address.
I have two problems:
in Windows I seem to need a php_ESL.dll which I can't find anywhere. The only files I've got are:
- ESL.php
- esl_wrap.cpp
- Makefile
- php_ESL.h
I have PHP Version 5.3.8 and in the ESL.php is used the dl() function and I get: Fatal error: Call to undefined function dl() in C:\xampp\htdocs\phpesl\ESL.php
+The dl() function is called in ESL.php:
// Try to load our extension if it's not already loaded. if (!extension_loaded("ESL")) { if (strtolower(substr(PHP_OS, 0, 3)) === 'win') { if (!dl('php_ESL.dll')) return; } else { // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'. // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'. if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') { if (!dl('ESL.so')) return; } else { if (!dl('ESL.'.PHP_SHLIB_SUFFIX)) return; } } }
Does anybody know how to solve this or encountered the same problem ?
Thanks.