PHP Agi in not working in cron

Hi
I am using php 7.2 and I have an agi which I want to execute through cron not from dial plan. It is not working from cron. On investigation found that I have to press enter at every time when I add phpagi class file.
When I run without class files it working perfect.

AGIs are meant to be executed by Asterisk, and have certain expectations. If you don’t need it to be an AGI, then just make it a normal script.

Thanks for feed back. Is it possible to run asterisk dial-plan from cron in which we would give desired Agi?

I don’t understand your question. You would need to originate a call through Asterisk to then execute dialplan. You may want to explain exactly what you are attempting to achieve instead of the low level details like this.

This could be path issue , when running from cron some script paths are not found

My purpose is to run a originate script , for auto dialer, get leads from hopper and dial numbers.

Use AMI, not AGI. AGI is for first party control.