Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining Lisp and PHP code in the same application

At the moment I use PHP for almost everything I develop for the Web but its linguistic limitations are starting to annoy me. However, as I developed some practices and maintain some PHP libraries that help me a lot, I don't feel I'd be ready to just switch to LISP throwing away all my PHP output. It could even be impossible on the servers where all I have access to is a regular LAMP hosting account.

Ergo, my questions are: Could LISP code be just combined with PHP one? Are there solutions for side-by-side LISP/PHP, interface for their interoperability or perphaps just an implementation of one for the other? Or is it a mutually exclusive choice?

like image 600
Meisner Avatar asked Sep 28 '08 11:09

Meisner


1 Answers

It's not a mutually-exclusive choice, you can run both on one system, in the same way that perl and php (for example) are run side-by-side on many systems.

There's a good post here on a similar topic, which suggests using sockets to communicate between both languages -

If you want to go the PHP<->Lisp route the easyest thing to do would be to make PHP communicate with your Lisp-process using sockets.

http://php.net/manual/en/ref.sockets.php

http://www.sbcl.org/manual/Networking.html

This approach does still leave you with the potential added complexity and maintenance issues you get from having 2 languages in your project, but might be a fit for your particular use case.

like image 113
ConroyP Avatar answered Sep 21 '22 03:09

ConroyP