Using Yate's PHP library on windows
(→Test the installation) |
(→Test the installation) |
||
(11 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | Test an existing PHP script on Windows. | + | Test an existing PHP script on Windows. <br> |
+ | By default Yate communicates through pipes with any script, but in Windows this is not possible, so a listener in [[External Module|external module]] must be configured to connect to a TCP socket. | ||
===Install PHP=== | ===Install PHP=== | ||
− | Download and install the latest | + | Download and install the latest PHP version package from http://www.php.net/downloads.php. I suggest the self installer [http://windows.php.net/download/ mirror].<br> |
− | Run the installer and don't forget to add the '''socket extensions''' (needed to connect to | + | Run the installer and don't forget to add the '''socket extensions''' (needed to connect to Yate via TCP). |
===Setup a listener=== | ===Setup a listener=== | ||
Line 21: | Line 22: | ||
===Modify provided example php files=== | ===Modify provided example php files=== | ||
− | These are found under <yatehome>\share\scripts. Let's open test.php and modify it as following: | + | These are found under <yatehome>\share\scripts. Let's open test.php and modify it as following: <br> |
− | change line | + | change line 34 from |
Yate::Init(); | Yate::Init(); | ||
Line 29: | Line 30: | ||
Yate::Init(true, "localhost", 5039, ""); | Yate::Init(true, "localhost", 5039, ""); | ||
− | + | ||
''(init without parameters uses unix sockets to connect - in windows you have to use TCP)'' | ''(init without parameters uses unix sockets to connect - in windows you have to use TCP)'' | ||
Line 38: | Line 39: | ||
* connect to yate in telnet and type "external". Output should be: | * connect to yate in telnet and type "external". Output should be: | ||
− | + | external | |
+ | 1. test | ||
raise debug level (debug on) and you should be able to see timer messages. | raise debug level (debug on) and you should be able to see timer messages. | ||
+ | |||
+ | PHP Message: engine.timer id: 0xb636e144.347529168 | ||
+ | PHP Message: engine.timer id: 0xb636e144.964829973 | ||
+ | PHP Message: engine.timer id: 0xb636e144.38930286 | ||
+ | ................................ | ||
+ | |||
'''See also''' | '''See also''' | ||
− | |||
* [[Starting on windows]] | * [[Starting on windows]] | ||
+ | * [[External Module]] | ||
+ | |||
+ | [[Category:Extmodule]] [[Category:PHP]] [[Category:Programmers]] [[Category:Scripting]] [[Category:Windows]] |
Latest revision as of 13:52, 4 November 2013
Test an existing PHP script on Windows.
By default Yate communicates through pipes with any script, but in Windows this is not possible, so a listener in external module must be configured to connect to a TCP socket.
Contents |
[edit] Install PHP
Download and install the latest PHP version package from http://www.php.net/downloads.php. I suggest the self installer mirror.
Run the installer and don't forget to add the socket extensions (needed to connect to Yate via TCP).
[edit] Setup a listener
Add the following section to extmodule.conf (the word after "listener" will become the module name)
extmodule.conf [listener test] type=tcp addr=0.0.0.0 port=5039 role=global
[edit] Modify provided example php files
These are found under <yatehome>\share\scripts. Let's open test.php and modify it as following:
change line 34 from
Yate::Init();
to
Yate::Init(true, "localhost", 5039, "");
(init without parameters uses unix sockets to connect - in windows you have to use TCP)
[edit] Test the installation
- Restart yate
- Execute php test.php
- connect to yate in telnet and type "external". Output should be:
external 1. test
raise debug level (debug on) and you should be able to see timer messages.
PHP Message: engine.timer id: 0xb636e144.347529168 PHP Message: engine.timer id: 0xb636e144.964829973 PHP Message: engine.timer id: 0xb636e144.38930286 ................................
See also