user1464055
user1464055

Reputation: 633

Using a Perl CGI Session in PHP

Is there anyway to get Perl Cgi session information within PHP? Most of the site I'm working on is programmed in Perl, except for a small portion. This portion uses PHP instead, and I was wondering how I could use the Perl CGI Session information from within PHP.

I was thinking of executing a perl script upon entering the page through exec that verified the session information, but I was hoping there was a better way to access the session variables, preferably one that would work without the use of exec.

Any suggestions?

If it helps, the segment that's in PHP is loaded within an iframe on the page. I'm using Perl's CGI:Session module to create the sessions.

If you need anymore information, just let me know.

Upvotes: 2

Views: 1189

Answers (1)

user353255
user353255

Reputation: 315

https://metacpan.org/module/CGI::Session::Serialize::php

You init call would be something like this:

my $session = CGI::Session->new( 'serializer:php' );

I am not 100% sure on the php side. CGI::Session::Serialize::php uses https://metacpan.org/module/PHP::Session so it may just work automatically with php. If not you will have to point php to the perl session file.

One more edit.

If that does not work you could use https://metacpan.org/module/CGI::Session::Serialize::yaml

Then have php parse it http://php.net/manual/en/book.yaml.php

Upvotes: 2

Related Questions