# Executing a PHP Script with Asterisk

**URL:** <https://community.asterisk.org/t/executing-a-php-script-with-asterisk/321>\
**Category:** Asterisk Support\
**Created:** [May 18, 2005, 4:47pm UTC](https://community.asterisk.org/t/executing-a-php-script-with-asterisk/321 "2005-05-18T16:47:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![larsonc](https://avatars.discourse-cdn.com/v4/letter/l/3ab097/32.png) [@larsonc](https://community.asterisk.org/u/larsonc)\
**Post date:** [May 18, 2005, 4:47pm UTC](https://community.asterisk.org/t/executing-a-php-script-with-asterisk/321/1 "2005-05-18T16:47:42Z")

</div>

Can aboby provide any good info on how to setup and execute a .php script with Asterisk AGI.

I have found so many bits and pieces, but nothing seems to work.

If I create an .agi script it works just fine. If I run the .php from a web browser it works just fine.

When I use any of the following, it fails:

exten =\> 77,agi,wakeup.php  
exten = \> 77,agi|php wakeup.php

I have also created a ln -s /usr/lib/php php

and on and on… I get a permisson denied… I have done a chmod 755, 777, chgrp to asterisk, root, apache, etc., etc., etc… on the file as well.

Any help on executing a .php script within asterisk would be great…

Thanks,

Cliff

---

<div class="post-metadata">

**Author:** ![natas](https://avatars.discourse-cdn.com/v4/letter/n/e99b99/32.png) [@natas](https://community.asterisk.org/u/natas)\
**Post date:** [May 18, 2005, 7:24pm UTC](https://community.asterisk.org/t/executing-a-php-script-with-asterisk/321/2 "2005-05-18T19:24:16Z")

</div>

use the system command. check the wiki for the exact usage but its something like this (i dont remember how you execute php programs from the command line)

exten = \> 77,1,System(php /directory/wakeup.php)

---

<div class="post-metadata">

**Author:** ![lamy](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/lamy/32/1461_2.png) [@lamy](https://community.asterisk.org/u/lamy)\
**Post date:** [September 1, 2005, 10:29am UTC](https://community.asterisk.org/t/executing-a-php-script-with-asterisk/321/3 "2005-09-01T10:29:13Z")

</div>

try this link [http://www.voip-info.org/tiki-index.php?page=Asterisk+AGI+php](http://www.voip-info.org/tiki-index.php?page=Asterisk+AGI+php)
