Sharedance is a high-performance server in which centralizes ephemeral key/data twos on out of the way website hosts, without worrying about overhead as well as the difficulty of the SQL databases. It was largely meant to talk about caches as well as sessions among any share involving web computers. Use of any sharedance server is unimportant via a uncomplicated PHP API which is appropriate for the particular targets involving PHP 4 as well as 5 period handlers.
Step 1: Download Sharedance and extract
Use following command to download and extract tar file:
# cd /var/www/html
# tar -zxvf sharedance-0.6.tar.gz
Step 2: Install Sharedance
Follow below steps to install Sharedance:
# make install-strip
Step 3: Start Sharedance
After the installation we have to start sharedance server. Use following command to start Sharedance service:
/var/www/html/sharedance-0.6/src/sharedanced --directory=/var/lib/php/session/sharedance --daemon
/usr/local/sbin/sharedanced --directory=/var/lib/php/session/sharedance --daemonize
When we start Sharedance service 2 processes will show in process list.
# ps -aux | grep sharedance
491 2621 0.0 0.0 111520 568 ? Ss 11:44 0:00 sharedanced [SERVER]
491 2622 0.0 0.0 111520 352 ? SN 11:44 0:00 sharedanced [CLEANUP]
i) sharedanced [SERVER]: Accepts new connections and stores/fetches/deletes the data
ii) sharedanced [CLEANUP]: Purges expired entries
Step 4: Session Directory
Now we need to create an empty directory where we session file as well as cache will store. Use following command to create directory
# mkdir -p /var/lib/php/session/sharedance
Step 5: Copy Directory in WebServer Code
After creating directory for session sharing and cache we copy php directory to each subdomain DocumentRoot.
# cd /var/www/html/sharedance-0.6
# cp -rf php /DocumentRoot/session_sharing
Step 6: Change SESSION_HANDLER_HOST value
Edit the session_handler.php file of the folder session_sharing & change the value of SESSION_HANDLER_HOST from localhost to name or IP address of the server running sharedanced.
# vim /DocumentRoot/session_sharing/session_handler.php
Step 7: Change value in PHP configuration file
Change following values php configuration file:
# vim /etc/php.ini
# Old Value
session.save_handler = files
# New Value
session.save_handler = user
Step 8: Restart Apache
# service httpd restart
Include session_handler.php on top of each script in order to use sharedance to store sessions.
The file /var/www/html/sharedance-0.6/php/sharedance.php contains basic PHP functions that connect & use the sharedance server.
The file /var/www/html/sharedance-0.6/php/session_handler.php should be included before every script in order to use sharedance to store sessions.
Sharedance listens to TCP port 1042 by default.