Logo
  • PHP
    • HipHop / HHVM
    • Modern PHP
    • PHPStorm
    • LAMP
    • Laravel
    • Composer
    • PDO
  • JavaScript
    • node.js
    • AngularJS
  • CSS
    • SASS
    • “CSS4” (CSS level 4)
  • HTML
  • Git
  • LAMP
  • Vagrant
  • UI / UX
  • Architecture of …
  • Off-Topic
With ♥ from Berlin
August 25, 2013
Chris
Linux, Login, PHP, php-login project
Comments Off on How to install php-login-minimal on Ubuntu 12.04 LTS

How to install php-login-minimal on Ubuntu 12.04 LTS

PreviousNext
the-php-login-project

In this article I’ll show you how to install the minimal version of the php-login.net‘s login script (see the GitHub repo here) on a standard Ubuntu server – in a very short and a very detailed way.

 

THE VERY SHORT TUTORIAL:

If you prefer a short tutorial, do it like this: First, make sure you have PHP 5.3.7+ and MySQL 5 running! Then copy the content of the php-login-minimal folder to your server’s web root (or whereever you want to have it) and perform the SQL statements from within both files in the “_installation” folder on your MySQL database (usually via PHPMyAdmin or on the mysql command line). Open the config/db.php file and change the database user and the password where it says “DB_USER” and “DB_PASS“. Your app is now running.

 

THE VERY DETAILED TUTORIAL:

THE BASIC REQUIREMENTS:

  1. A server, in this tutorial we’ll use Ubuntu 12.04 LTS as the operation system.
  2. Apache installed on the server.
  3. PHP 5.3.7 or higher installed on the server (this includes PHP 5.4+ and PHP 5.5+). PHP introduced some hashing algorithms (that are used in this script) in version 5.3.7, so you definitely need this. This tutorial will show you how to check your PHP version and how to upgrade PHP.
  4. MySQL 5 or higher installed on the server. This tutorial will show you how to check and eventually install MySQL if it’s not done already.
  5. You should be able to access your server via SSH.
  6. You should know the basics of how a server works, how to login via SSH, how to use the linux command line and how to copy files to your server.

 

THE FURTHER REQUIREMENTS:
Find out which version of PHP your server runs

Create a file called phpinfo.php on your local computer and put the following stuff in there:

<?php
phpinfo();

The function phpinfo(); shows the entire configuration and settings of PHP, so it’s perfect for inspecting and finding out what your installed version of PHP can do and what not. I think it’s a good idea to create such an phpinfo.php on every new server you set up.

Copy the file to your server’s web root folder, usually /var/www/ ! For easily accessing a server via SSH in Windows 7/8 I can recommend WinSCP and Putty. WinSCP let’s you log in via your SSH credentials (username and password OR via SSH key file) and look at your server like in a FTP tool while Putty is a simple, but effective command-line tool. WinSCP will automatically open Putty (already connected to your server) when you log in.

When you have moved the phpinfo.php file to your web root, open your browser and go to

http://www.yourdomain.com/phpinfo.php

You’ll see something like this:

check for correct php version, must be PHP 5.3.7 or higher

Is your PHP version 5.3.7 or higher ? Fine, then let’s go on ! If not, then you are using a very old version of PHP that should be updated instantly.

By the way, you can also find out your installed PHP version by doing this on the linux command line (but we did it the above way to check if your server displays php files correctly ;)

php -v

 

THE FURTHER REQUIREMENTS:
Update the PHP version (if older than 5.3.7)

Updating PHP is a big topic, so let’s do it the quick way. To update PHP, log into your server and do this on the command line (or “shell” or “bash”, whatever you call it):

sudo apt-get update

to let your system (beside some other stuff) check for updateable software, then do this to upgrade PHP:

sudo apt-get --only-upgrade install php5

After this is done, restart the Apache server with:

sudo service apache2 restart

Now check the installed version of PHP with a simple:

php -v

Is it 5.3.7 or higher now ? Perfect ! If not, then you should contact your server provider, hoster etc. and ask for an update or simply get a modern server somewhere else. It’s 2014, ladies, and the 5.3 branch of PHP has officially reached the End of Life, which means no more updates for this branch. Seriously, there is really no good reason to use a 3+ years dead version of PHP.

 

THE FURTHER REQUIREMENTS:
Install MySQL server (if not installed)

This version of the login script needs a MySQL database, so let’s check if MySQL 5.1 or higher is installed. Have a look into your phpinfo.php output screen and search for the mysqli [the last character is an “i” !] block. It should look like this (the version number is not important right now, usually it will be 5.1, 5.5 or 5.6):

check if mysqli is installed

Everything there ? Wonderful! If not, then we have to install MySQL right now: Do

sudo apt-get upgrade

and

sudo apt-get install mysql-server php5-mysql

to install the MySQL server. You’ll be asked for a new password: Choose wisely, choose strong ! By the way: There seem to be problems with VERY long passwords and passwords that use exotic characters, so you should not overcomplicate things.

To activate everything, restart the Apache server:

sudo service apache2 restart

To prove everything is installed correctly, reload your phpinfo.php screen and have a look. You should find a mysqli info block that looks like the picture above !

 

THE FURTHER REQUIREMENTS:
Install PHPMyAdmin (for easy database handling)

Handling databases is a complex and error-prone thing, so why not using the standard PHP/MySQL-database administration tool ? PHPMyAdmin is my weapon of choice, so let’s install it via these commands (the “update” is only necessary when ubuntu doesn’t find an installable version of phpmyadmin, this happens sometimes on fresh servers):

sudo apt-get upgrade
sudo apt-get install phpmyadmin

You’ll be asked for the MySQL password you have provided in the last step. In a professional application it’s not good to log into phpmyadmin with THIS user/password, and in general it’s a bad idea to have phpmyadmin running on a live server (as it makes attackers’s life much easier), but for this installation tutorial it might be totally okay. You can log into PHPMyAdmin then on:

http://www.mydomain.com/phpmyadmin

Log in with “root” and the password you have given.

 

THE INSTALLATION PROCESS:
Change the database password

Edit your config/db.php and put in your database user (in your case probably “root”) and the password.

 

THE INSTALLATION PROCESS:
Copy the script to your server

This step is easy: Delete the phpinfo.php from your server (as it is not necessary anymore and will give potential attackers informations about your server) and copy the contents of the php-login-minimal folder to your web root, usually /var/www/. This folder should now look like (screenshot from WinSCP):

how your root folder should look like after copying the php-login script to your server

 

THE INSTALLATION PROCESS:
Creating the database

Log into PHPMyAdmin:

http://www.yourdomain.com/phpmyadmin

and create a database called “login” with the SQL statement in “_installation/01-create-database.sql“, then do the same with the file “_installation/02-create-and-fill-users-table.sql” to create the user-table. It’s also possible to import the files. The PHPMyAdmin user interface is quite self-explaining, so this should not be a problem.

The script is now ready to go under your web address:

http://www.yourdomain.com/

 

SOME WORDS ABOUT LOCAL & REMOTE DEVELOPMENT

It’s always a good decision to develop LOCALLY, which means directly on your own computer, or even better, within a virtual machine hosted on your system. Usually, developing on a live server on the web might be critial, because your tools might have no or weak passwords, your app is in development and therefore attackable, or simply because you just mistyped a bash command and your server now tries to download the entire web.

When developing locally, you could install PHP, MySQL etc by hand or use a pre-combined and pre-configured easy-to-handle development bundle, like Ampps [Win, Mac], EasyPHP [Win], WampServer [Win], SecureWAMP [Win] or even Xampp [Win, Mac, Linux].

—

Please note: Comments are closed!: Sorry, but I had to remove / deactivate the comments in this and other articles as lots of idiots and trolls commented with masterpieces a la “script is shit does not work plz help”, “does not work on android”, “you must change X to Y”, “explain to me” etc. without realizing what this script is, why there’s a readme and several tutorials and lots of commented code and what free-time open-source scripts in general are. It’s disturbing that people build their entire businesses on top of totally free software, written by unpaid volunteers in their free-time, and then they still complain and treat the autors like shit.

minimalpassword hashingPHPtutorial
Share this
js javascript

How JavaScript really works – An introduction into the JavaScript call stack by Philip Roberts (20min video)

css3-chrome-font

Google rolls out Chrome 37, finally fixes horrible font-rendering

Google has rolled out Chrome 37 today, a legendary milestone that fixes one of the most annoying “bugs” in frontend

Interesting stats on SONY’s hacked passwords

In 2011 SONY’s Playstation network got hacked, 77 million accounts have been compromised, and more than 1.000.000 passwords – saved

php

How to install PHP 7.0 on Ubuntu 14.04 LTS

You want to install PHP 7 within 60 seconds ? No problem, but first make sure you have a fresh

increase-your-pagespeed-score

Increase your PageSpeed score (10min video with Matt Gaunt)

Compact and clever information for dramatic speed increases. Definitly worth watching.

Rare Steve Jobs AND Bill Gates video interview from 2007’s D5 conference (90min)

This is something great! Two of the most important people in the last 20 years’s mainstream consumer IT history in

sass

[german video] Modernizing and minimalizing frontend markup code at AutoScout24

As this blog has a lot of german speaking readers I’ll post german stuff from time to time. Sorry for

sass

New features in SASS 3.3 (a talk by SASS-creator Chris Eppstein)

A very interesting conference talk by Chris Eppstein, creator of SASS itself, showing some of the new features in SASS

angular js

Learn AngularJS in 20 (or 90) minutes with Dan Wahlin

Definitly two of the best and most up-to-date short-introductions into AngularJS: Dan Wahlin shows how to build a full little

shadow dom

Crossbrowser-safe HTML5 video (IE6+) with a few lines of code and just one .mp4 video file

No time to read the full article ? Get the code directly here on GitHub: panique/html5-video. Publishing a video on

1/4

Categories

Search

php
How to install/setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1/7.2 (and how to fix the GPG key error)
hearthbleed-ssl-bug
A quick guideline on how to fix the Hearthbleed bug (and update OpenSSL) on Ubuntu
composer
Composer problems ? Try full reset !
composer
[Link] How to require versions of PHP, HHVM / HipHop, GD, curl, openssl etc. with Composer
DigitalOcean coupon voucher 50
Only today: $50 coupon for DigitalOcean SSD VPS / hosting
The New Era of JavaScript (28min conference talk, Jack Franklin, 2013)
mod-rewrite-ubuntu-14-04-lts
How to install / setup PHP 5.5.x on Ubuntu 12.04 LTS
sass
New features in SASS 3.3 (a talk by SASS-creator Chris Eppstein)
github-logo-octocat
GitHub buys Easel.io, a code-free full website creator worth a look
phpstorm 7.0 php
How to setup and use XDEBUG with PHPStorm 6/7 (locally in Windows 7/8 and Mac OS X)
Adobe releases Firebug-like developer tools to edit and extract PSDs
-45% (or even 50%) off on DesignWall today
css3-chrome-font
Google rolls out Chrome 37, finally fixes horrible font-rendering
What’s new in PHPStorm 9
Bézier Curves – Under the Hood (4min video)

Tags

apache bash centos composer conference coupon CSS debian fonts framework git GitHub hack HHVM HipHop HTML HTML5 IDE JavaScript JS LAMP laravel linux mod_rewrite MVC MySQL Nginx optimization PHP PHP 5.5 PHP 5.6 phpmyadmin PHPStorm security server SSD Ubuntu UI UX vagrant video virtual machine voucher VPS wordpress
Side-Project: Wordle-Solver:
www.wordle-helper.info

Pages

  • Privacy Policy