通过PHP沟通交互式Shell

Supposed to Open SHELL App (C) which i Coded as interface for my purpose I Already know about exec and shel_exec which couldn't be helpful on this.

My Console Application which i had to OPEN on php is interactive shell and batch (Both Modes are available).

I Need to communicate to shell, not just opening and get result (like exec func). I want to Open My Shell and Send commands to it , which can be Interactive I/O or batch I/O.

Well If No Straight solution found with php built in Function I am going to pass my command as String Parameter to console application

But Straight solutions with php built in library and behavior still would be accepted