You are here

php

PHP 7.0 (and 5.6) on the same pc

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

Switch PHP version:

From php5.6 to php7.0:
Apache:

sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart

CLI:

Simple function to generate the password, given a length.

    /* Defining the function */
    function pwgen ($len) {
        /* Variables declaration */
        $pw = "";
        $wordBook = array ();
        /* Fill array with printable english characters */
        for ( $wb=33; $wb<127; $wb++ ) {
            array_push ( $wordBook, $wb );
        }
        shuffle ( $wordBook ); // Shake
        $pass = array_rand ( $wordBook , $len ); // Slice a part
        shuffle ( $pass ); // Shake again
        /* Save the array into variable */