PHP Intergration

Dose anyone here have a good solution for integrating legacy php systems into the GoLang URL system…

So you can take POST/GET php code and have a pass through GoLang <-> PHP <-> GoLang

Just wondering how everyone handles non GoLang code if you are having to use python / perl / ruby / php / etc…in URL’s

I’m confused. What about your urls requires php? Can you give an example of exactly what each piece of code would be doing so I can understand what you need a little better?

Say you have an accounting package in php…

http://somedomain.com/admin/accounting.php

You do not want to rewrite all the php code in GoLang but you still want to use the accounting package

in GoLang you have your routes and URL for /admin/accounting… How would you allow GoLang to bypass all of its stuff and directly hand everything off to php? So GoLang will just step out of the way on everything that is /admin/accounting URL

You would probably not involve Go into a existing PHP code base like that at all.

I need to put that php code and perl code and some python code under different URL’s in GoLang… So I am looking for a easy way to hand off in GoLang to those different kinds of languages… Fork is not passing the POST/GET data…and it’s not passing the HTML back to the browser…

I know someone most haft a simple solution for this…legacy code in newer languages…like GoLang

That’s not specific to Go. This problem arises the very moment when you start mixing two languages.

And in this case it is more a question for PHP not to serve the Golang parts, as your PHP code will most likely be served by some Apache webserver.

This one must be configured to send all requests to the Golang upstream instead of the PHP interpreter and not the other way round.

Not understanding what you are trying to say. Are you basically talking about channels or like unix pipe? Have php code run and pipe that into a channel in golang? Or some kind of socket.

PHP can run with or with out a webserver. I am not using Apache. I am on Nginx and I have a work around in Nginx with Nginx cutting off GoLang when it detects a PHP URL and dose not pass the traffic to GoLang but I would prefer to do everything inside of GoLang URL Routes not have Nginx heading off what goes to GoLang.

This is not a question about or related to Go. Please learn how web-servers work and how they relate to programming languages.

Start out by searching for something like 'how does a web-server work with php’
This is not the appropriate place for it :slight_smile:

2 Likes