X
    Categories: Tutorials

Install php-login.net script on Debian Wheezy

In this article we will show you how to install php-login.net’s script on Debian Wheezy VPS with PHP-FPM, Nginx and MySQL. According to the developer, the php-login script is a simple, secure, clean, stylish, non-nerdy, well documented, object-oriented, totally free and reduced to the max PHP login script. The script is available in 4 versions, one-file version, minimal version, advanced version and full mvc framework. Today we will show you how to install php-login full mvc framework version.


Install MySQL and create a database.

apt-get update
apt-get upgrade
apt-get install mysql-server mysql-client
mysql -uroot -p
CREATE DATABASE login.
GRANT ALL PRIVILEGES ON login.* TO 'loginuser'@'localhost' IDENTIFIED BY '_LOGINUSER_PASSWORD_';
FLUSH PRIVILEGES;
/q

Install Nginx and PHP-FPM

apt-get install nginx php5-fpm php-cli php5-mysql php5-gd php5-mcrypt

Download and configure php-login script

– download and unzip

wget https://github.com/panique/php-login/archive/master.zip -P /tmp
unzip /tmp/master.zip -d /tmp

– Create a root directory for your web site and move php-login files into it

mkdir -p /var/www/yourwebsite.com/{public_html,logs}
rsync -aq /tmp/php-login-master/4-full-mvc-framework/ /var/www/yourwebsite.com/public_html/

– Database configuration
Open the config.php file and change the following

vim /var/www/yourwebsite.com/public_html/config/config.php
define('URL', 'http://yourwebsite.com/');

define('DB_TYPE', 'login');
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'phplogin');
define('DB_USER', 'loginuser');
define('DB_PASS', '_LOGINUSER_PASSWORD_');

– Import MySQL structure

mysql -uroot -p login < /var/www/yourwebsite.com/public_html/__install/sql_files/note.sql
mysql -uroot -p login < /var/www/yourwebsite.com/public_html/__install/sql_files/users.sql

Nginx configuration.

Create a new Nginx server block with the following content

# /etc/nginx/sites-available/yourwebsite.com
server {
  server_name yourwebsite.com;
  listen 80;
  root /var/www/yourwebsite.com/public_html;
  access_log /var/www/yourwebsite.com/logs/access.log;
  error_log /var/www/yourwebsite.com/logs/error.log;
  index index.html index.php;
  location / {
    try_files $uri $uri/ @rewrites;
  }
  location @rewrites {
    #rewrite ^ /index.php last;
    rewrite ^/(.*)$ /index.php?url=$1 last;
  }
  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }
  location ~ /\.ht {
    deny  all;
  }
  location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

Symlink it and restart the server

ln -s /etc/nginx/sites-available/yourwebsite.com /etc/nginx/sites-enabled/yourwebsite.com
/etc/init.d/nginx restart

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.