troglobit/merecat

merecat cgi and php?

sanyaade-iot opened this issue · 7 comments

Hi Everybody,

Managed to build merecat on Ubuntu 16.04, it builds and runs but it wont process php script files since it

have impossible to set path for php-cgi interpreter directory.
I have put the php-cgi executable binary in cgi-bin directory

I will like to use it along with PHP and other CGI executable/interpreters. Many thanks!

Please help: pointers, directions, examples on how I might achieve this.

Hear from you soon!

God blesses!!!

Best regards,
Sanyaade

I've never tried to run PHP scripts with Merecat, but I see no reason it shouldn't work. Unless it requires "fast CGI", which Merecat doesn't have.

I recently got a question about running cgit in Merecat, I've documented that on my blog:

http://troglobit.com/2018/03/cgit-with-merecat-httpd/

@troglobit 👍

Thanks for getting back to me. I will checkout the link and seek more help if needed
I am trying to run a custom made Php cgi with merecat on ESP32 or ESP8266

Once again, many thanks!

Speak to you soon!

God blesses!!!

Best regards,
Sanyaade

If you dig into the details yourself, you might want to search for "thttpd and PHP", since Merecat is based on thttpd. You may get some helpful hints and pointers ...

@troglobit : Evening,

Yes! I already tried thttpd. Both Merecat and implement a pattern search but there was no function to load and execute php-cgi when pattern is matched. Merecat and thttpd point to the cgi-bin folder but not loading or execute a particular cgi executable/interpreter for the matched scripts.

Say for example I have php, perl, python plus my own interpreter inside the cgi-bin folder then how do I tell Merecat to run python if a .py extension is matched. Merecat and thttpd rely on host systems or pipeline. These are unlike in the embedded or memory constraint devices.

I was able to do this with Mongoose CGI function but I will like to port as Merecat and others to embedded platform like ESP8266, STM32, PIC with custom cgi facilities. I believe an extendable function or switch statement could be implemented to cater for this.

Many thanks!

Update you soon!

God blesses!!!

Best regards,
Sanyaade

Following up on old issues. Did you get anywhere with this, or should we close this?

I was unable to do it in Merecat but planning to implement same function from Mongoose. Anyway I was face with file-systems and folder access on Mongoose tool so I have to resort back on adding SDCard to ESP8266. I will close the issue for now until I am able to return to it later.

Many thanks!

God blesses!!!

Best regards,
Sanyaade

For anyone winding up here from a Google search, I've just added native PHP support, using php-cgi not SAPI, in commit 9138c21. It will be part of the v2.32 relase.