How to run together: PSGI and PHP?
I have Perl/PSGI application (running under pure perl Starman server). Now, for some reason need run one PHP application too ;(, so (probably) need Apache2. Questions:
Plus:
the server is behind my home NAT router. Internal server has address: 192.168.1.10, from the outside, ofc, the router have correct internet address. I have redirected all traffic
routerIP:80 -> 192.168.1.10:80
Ps: I don't need optimize performance, the server is only for home/demo/testing purpose.
EDIT: Now, in another similar situation I checked CPAN again and based on @rawhide's answer I found the Plack::App::PHPCGI module. Works great - it is really cool testing php apps under plackup... ;)
You can execute it as CGI (fork+exec) either using Plack::App::CGIBin
or using WrapCGI directly
my $rawapp = Plack::App::WrapCGI->new(script => "rawhide.php" , execute => 1 )->to_app;
builder {
mount "/rawhide" => $rawapp ;
};
If rawhide.php has no shebang, you'd use /usr/bin/php /path/to/rawhide.php
The easiest would be to run Apache2 and PHP on port 80, and install mod_proxy to the Apache process and reverse proxy some of the path to the backend Starman. You can also run php using php-fpm as a FastCGI, and do the same thing.
Since it is a demo purpose, you can go crazy and run Starman on port 80 instead, and then use Plack::App::FCGIDispatcher to "mount" the FastCGI PHP process. I tried that once - it worked well, but probably only for the demo purpose, not for the production use.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.