Trigger script for incoming calls (AGI?)

Should I use AGI if I just want to trigger a PHP script for incoming calls?

I’m very new to this and i’m not sure if I’m on the right track. In /etc/asterisk/extensions.conf, I have this:

exten => 106,1,AGI(testing.php)

then i reload the config via CLI.

testing.php is executable in /var/lib/asterisk/agi-bin, and it just writes a lot for now when i execute it manually, but it does not execute for incoming calls to extension 106.

can someone point me in the right direction?

That snippet is fine. Chances are you have an issue with your AGI script, either (1) permissions [can it be executed by the asterisk user?] or (2) if you are a windows user, you may have windows new line characters in it which AGI will throw up on.