Upgrade to PHP 7.0 on Ubuntu

Ref : https://www.stewright.me/2016/03/upgrade-php-7-0-ubuntu/

Prerequisites and disclaimer

My server is a Ubuntu 14.04 box that uses Apache 2.4 and PHP 5.5.9 prior to upgrade. These instructions are for Apache 2.4 users with a similar configuration, and I recommend you test in isolation before using in a production environment. Proceed at your own risk.

Step 1 – Add a new Apt source

At the time of writing, I’m using the packages maintained by a guy called Ondřej Surý (he’s worth a follow on Twitter) until there’s a Debian package for PHP 7 in the official release channels.

To do this, enter the following command into the box you’re upgrading:

sudo add-apt-repository ppa:ondrej/php

You’ll probably be prompted to enter your password at this point. Go ahead and enter it.

Step 2 – Install updates and the PHP 7.0 package

Next we’re going to update and upgrade packages on our system to ensure everything goes smoothly. You can do this in a single command with:

sudo apt-get update && sudo apt-get upgrade

Once this has finished, we’re ready to install PHP 7.0. Enter the following command into your terminal:

sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-mcrypt php7.0-curl

This will install PHP 7.0, along with a number of commonly used PHP packages including the Apache PHP 7 module. I found that everything else pretty much worked without being installed separately. That’s it pretty much. You shouldn’t need to make any configuration changes and everything should just work.

Step 3 – Test to ensure your server is using PHP 7.0

From the command line, type the following command:

php -v

Sending email with WebMail in laravel 5.2

1) 
===================================================================================
.env
===================================================================================
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:xVpNKIpjAe7LoKTrVd7pKOdJrsaiLmSy8tLYMjerJMS0=
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test_db
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=cpanel1.cloud.com
MAIL_PORT=587
MAIL_USERNAME=test@mywebmaildomain.com
MAIL_PASSWORD=testPassword
MAIL_ENCRYPTION=tls

===================================================================================
config/mail.php
===================================================================================

<?php return [ 'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'cpanel1.cloud.com'),
    'port' => env('MAIL_PORT', 587),
    'from' => ['address' => 'test@mywebmaildomain.com', 'name' => 'Bacekend System'],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',
];
===================================================================================

Setting up LEMP on Digital Ocean One Click Droplet to run the Laravel 5.2 web application

Setting up LEMP on Digital Ocean One Click Droplet to run the Laravel 5.2 web application

1) login with SSH
2) sudo apt-get update
3) sudo apt-get upgrade
3) copy the MySql admin password from /root/.digitalocean_password
4) run “mysql_secure_installation”
5) try to install composer
5.1) sudo apt-get install curl php5-cli git
5.2) curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin –filename=composer

6) go to /var/www
7) git download project folder
7.1) sudo chown -R :www-data /var/www/project_folder
7.2) sudo chmod -R 775 /var/www/project_folder/app/storage
7.3) sudo chmod -R 775 /var/www/project_folder/app/bootstrap
8) composer update –no-scripts
if you got error “allocate memeory case”
run the following commands to fix that issue
8.1) sudo fallocate -l 1G /swapfile
8.2) sudo mkswap /swapfile
8.3) sudo swapon /swapfile

9) Setting up / linking dns of the domain at z.com
10) login to z.com
11) go to related domain and added three dns for digital ocean
11.1) ns1.digitalocean.com
11.2) ns2.digitalocean.com
1.3) ns3.digitalocean.com

12) check at hosting (digital ocean droplet) with ssh
12.1) who is internalmedicinesocietymyanmar.com
and it will return digital ocean dns
13) create new domain setting at digital ocean
13.1) go to Networking at Digital Ocan
13.2) create new domain
13.3) Create One Domain at Digital Ocean by creating Records
===================================
A Record
Name = @
IP Address = 128.199.141.135
A Record
Name = acepluscoderepo.com
IP Address = 128.199.141.135
===================================
CNAME Record
Name = www
IP Address = example.com.
MX Record
Name = 1
IP Address = aspmx.l.google.com.
===================================
MX Record
Name = 5
IP Address = alt1.aspmx.l.google.com.
===================================
MX Record
Name = 5
IP Address = alt2.aspmx.l.google.com.
===================================
MX Record
Name = 10
IP Address = alt2.aspmx.l.google.com.
===================================
MX Record
Name = 10
IP Address = alt3.aspmx.l.google.com.
===================================
MX Record
Name = 10
IP Address = alt4.aspmx.l.google.com.
===================================
TXT Record
Name = example.com
IP Address = v=spf1 ip4:128.199.141.135 ~all
===================================
NS Record
Name = ns1.digitalocean.com.
===================================
NS Record
Name = ns2.digitalocean.com.
===================================
NS Record
Name = ns3.digitalocean.com.
===================================

14) After installed the nginx server at linux server, tried to send / testing email can send or not ?
Open terminal and type the following command to check it.

echo “HelloWorld” | mail -s “HelloWorld” test@gmail.com
test@gmail.com is “to” email address

Conclusion
Cheers

How to Install Laravel with an Nginx Web Server on Ubuntu 14.04

How to Install Laravel with an Nginx Web Server on Ubuntu 14.04

1) Install the Backend Components
1.1) sudo apt-get update
1.2) sudo apt-get upgrade
1.3) sudo apt-get install nginx php5-fpm php5-cli php5-mcrypt git
--------------------------------------------------------------------------------------------------------------------------
2) Modify the PHP Configuration
2.1) sudo nano /etc/php5/fpm/php.ini
2.2) cgi.fix_pathinfo=0 
2.3) sudo php5enmod mcrypt
2.4) sudo service php5-fpm restart
--------------------------------------------------------------------------------------------------------------------------
3) Configure Nginx and the Web Root
3.1) sudo mkdir -p /var/www/laravel
3.2) sudo nano /etc/nginx/sites-available/default
=======================================================
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name server_domain_or_IP;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
=======================================================
3.3) sudo service nginx restart
3.4) if you want to setup 2 virtual block
3.4.1) sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com
3.4.2) sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
2.4.3) sudo nano /etc/nginx/nginx.conf
2.4.4) server_names_hash_bucket_size 64;
2.4.5) sudo service nginx restart
--------------------------------------------------------------------------------------------------------------------------
4) Create Swap File (Optional)
4.1) sudo fallocate -l 1G /swapfile
2) sudo mkswap /swapfile
3) sudo swapon /swapfile
--------------------------------------------------------------------------------------------------------------------------
5) Install Composer and Laravel
5.1) cd ~
5.2) curl -sS https://getcomposer.org/installer | php
5.3) sudo mv composer.phar /usr/local/bin/composer
5.4) sudo composer create-project laravel/laravel /var/www/laravel
5.5) sudo composer create-project laravel/laravel /var/www/laravel 4.2
5.6) sudo chown -R :www-data /var/www/laravel
5.7) sudo chmod -R 775 /var/www/laravel/app/storage
5.8) http://server_domain_or_IP
------------------------------------------------------------------------------------------------------------------------------
Conclusion
------------------------------------------------------------------------------------------------------------------------------






















PHP Fatal error: Class’Elibyy\TCPDF\ServiceProvider” in laravel

----------------------------------------------------------------
laravel framework version 5.2 
added at composer.json
 "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "laravelcollective/html": "~5.2",
        "uxweb/sweet-alert": "~1.1",
        "maatwebsite/excel": "~2.1.0",
        "intervention/image": "dev-master",
        "elibyy/tcpdf-laravel": "5.2.*"
    },
------------------------------------------------------------------
1) comment out 2 lines from config/app.php
1.1) at  'providers' => [ 
need to comment out 
//Elibyy\TCPDF\ServiceProvider::class,

1.2) at  'aliases' => [
need to comment out 
//'PDF'       => Elibyy\TCPDF\Facades\TCPDF::class,

------------------------------------------------------------------
2) composer update --no-scripts
3) un-comment previous 2 lines from config/app.php
4) run again "composer update --no-scripts"

Cheers