[Asterisk-Users] new2agi -php

Derek Bruce dbruce at calgarytelecom.com
Sat Mar 6 20:23:18 MST 2004


The code should run with the uid of the asterisk process... On my system
that's root... make sure the file permissions are 755 and that the ownership
are correct:

chown root.root /var/lib/asterisk/agi-bin/filename.agi
chmod 755 root.root /var/lib/asterisk/agi-bin/filename.agi

however, if the file permissions were wrong you should get an error like:

    Failed to execute '/var/lib/asterisk/agi-bin/test.agi': Permission
denied

I've tried a number of things, and can't duplicate the error you get... does
PHP function correctly for other scripts??

----- Original Message -----
From: "Doug Harris" <dogharris at sbcglobal.net>
To: <asterisk-users at lists.digium.com>
Sent: Saturday, March 06, 2004 7:11 PM
Subject: Re: [Asterisk-Users] new2agi -php


> Hi,
>
> Thanks for the insight. I am using PHP 4.2. So I guess code is still good.
>
> There arn't much code there so I played with it. I ran the same code with
> only the line
> #!/usr/bin/php -q
>
> and it shows me the same error. So I think the script don't even get run.
My
> php is in /usr/bin so path is correct. I wonder whether there is any
> permision or something missing here.
>
> When agi is run by asterisk, does it run as root ?
>
> thanks a bunch.
>
> doug
>
>
>
> From: "Derek Bruce" <dbruce at calgarytelecom.com>
> To: <asterisk-users at lists.digium.com>
> Subject: Re: [Asterisk-Users] new2agi -php
> Date: Sat, 6 Mar 2004 16:06:09 -0700
> Reply-To: asterisk-users at lists.digium.com
> This is a multi-part message in MIME format.
> ------=_NextPart_000_004E_01C40394.F061F050
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> your code:
> #!/usr/bin/php -q
> <?php
> ob_implicit_flush(true);
> set_time_limit(6);
> $stdout =3D fopen('php://stdout', 'w');
> fwrite($stdout,"STREAM FILE demo-congrats" );
> fflush($stdout);
> ?>
> The error message is generated by PHP... If your PHP version is higher =
> that v4.3.0
> line 5: $stdout =3D fopen('php://stdout', 'w');
> should be
> $stdout =3D fopen(STDOUT, 'w');
> I suspect that is the problem, as everything else looks file.
>
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list