Digital Ocean LAMP Ubuntu 16.04 PHP7

Private Cloud Server

Varis Vonguea-aree
Jul 24, 2017 · 3 min read

รับฟรีเครดิต $10 เท่ากับ 315 บาท สามารถสมัครสมาชิกได้ที่ DigitalOcean.com

ทำการ generate ด้วยโปรแกรม Putty Key Generator แล้ว copy public key ไปใส่

จะใส่ Key passphrase หรือไม่ใส่ก็ได้ และ save private key เพื่อเอาไป Auth ใน FileZilla

Generating a new SSH key

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

ติดตั้ง https Let’s encryption

Install phpMyAdmin

sudo apt-get update
sudo apt-get install phpmyadmin
For the server selection, choose apache2.
  • Select yes when asked whether to use dbconfig-common to set up the database
  • You will be prompted for your database administrator's password
  • You will then be asked to choose and confirm a password for the phpMyAdmin application itself

Then Finish

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

*(อย่าลืม sudo ln สร้าง path เข้า phpmyadmin)

sudo service apache2 restart

now phpmyadmin in web browser address bar

Composer

  1. sudo apt-get update

Now, let’s install the dependencies. We’ll need curl in order to download Composer and php-cli for installing and running it. The php-mbstring package is necessary to provide functions for a library we'll be using. git is used by Composer for downloading project dependencies, and unzip for extracting zipped packages. Everything can be installed with the following command:

  1. sudo apt-get install curl php-cli php-mbstring git unzip
  2. curl -sS https://getcomposer.org/installer -o composer-setup.php
  3. php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  4. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  5. test in composer

NPM

sudo apt-get update
sudo apt-get install nodejs

Laravel

composer create-project laravel/laravel /var/www/html --prefer-dist
chmod -R 777 storage

Install Mcrypt Extension(PHP7)

sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade

Problems

I have faced a similar error. I checked the log in /var/log/apache2/error.log and found an UnexpectedValueException

I changed the owner to my apache user of the storage folder under the project dir.

sudo chown -R www-data:www-data ./storage

In my case apache2 process owner is www-data, so change this to yours, this can be found in apache2 config file. Hope this is useful to you.

if not work try this

php artisan cache:clear 

chmod -R 777 app/storage

composer dump-autoload
Varis Vonguea-aree

Written by

❤⌚ Full Stack Web Developer ♛ varisz.com ♛

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade