Why is phpagi.php where it is?

I wondered if there was a reason why phpagi.php is in /var/lib/agi-bin? It would seem an odd place for me. Is there any reason why it isn’t in …/libraries/agi/phpagi.php for example, where a module could easily find it?

It would be best in what is defined in /etc/asterisk/asterisk.conf

As asteriskagidir=

/var/lib/asterisk has long been asterisk’s home directory. For some reason FreePBX reassigned to /home/asterisk, go figure.

The module doesn’t need to find it asterisk does.

Wrong. The AGI script needs to find it. Asterisk itself doesnt know anything about agi/phpagi.php that is included by other PHP scripts.

The only reason it’s in that folder is because all FreePBX files in there are not symlinked and the reference is relative. This will be fixed in version 14

res_agi looks for scripts rooted in ASTERISKAGIBIN. That has always been the case. However symlink away if you want. :slight_smile:

Yes that is true. If my file is called “call.php” then it will look in ASTERISKAGIBIN. Guess you aren’t understanding that phpagi.php is an include. Asterisk never calls it direct. Therefore “call.php” would include phpagi.php that is what neil is asking about, and the include can be located anywhere anywhere.

True but why do it that way?

Interesting. Any hints on where 14 will put phpagi.php

My interest in phpagi.php is that it is quite a slow loader (the second biggest time cost on module start up after bootstrap), any I suspect that many modules only need a small subset of its functionality. I am creating an include (possibly a class, possibly just a set of functions) that will provide a few core functions and should load and execute a lot quicker.

Looking to the future, where should it go? It might as well go there now!

If loading phpagi.php is slow then something is wrong with your system. Removing functionality from it won’t make it that much faster. I think you are trying to ask way to much of PHP