First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
http://stackoverflow.com/questions/24296212/php-nodejs-and-sessions#24303059 | |
You can use memcached as your session storage handler in PHP. Memcached is a simple key value store that can be accessed via TCP; there is a memcached module available for Node.js. | |
PHP stores the session in memcached by using the session id as the key. The session data (value) stored in memcached is a serialized PHP object, with a slight twist. You can read more about this unusual serialization at the SO question "Parse PHP Session in Javascript". Luckily though, there is already an NPM module out there: php-unserialize. | |
Now for the How-To. | |
Assumptions |
Before proceed, you may want to follow up
Create a middleware
<?php | |
function tinker(...$args) { | |
// Because there is no way of knowing what variable names | |
// the caller of this function used with the php run-time, | |
// we have to get clever. My solution is to peek at the | |
// stack trace, open up the file that called "tinker()" | |
// and parse out any variable names, so I can load | |
// them in the tinker shell and preserve their names. |