i struggled with this, but during API work it was helpful. hoping this post will help others in a similar situation.
make a new file, i.e. /tmp/test.php
and you can test out scripts / API calls on demand via
sudo -u asterisk php /tmp/test.php
contents should be similar to:
$FreePBX = FreePBX::Create();
More better, always run it as the apache owner. In the case of FreePBX, that means as Asterisk
sudo -u asterisk php /tmp/test.hhp
+1 to that, seen that confuse so many folks here, you are only asterisk when you tell the OS you are asterisk, when you are asterisk you have your own ‘environment’ which can be wildly diverse to what you thought (
Absolutely correct. I always forget that I usually “su asterisk” before doing these types of things.
There are a few examples of PHP command line scripts in the forum archives. Thanks for sharing this. I would love to see more people sharing these kinds of tips and little utilities.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.