Setup Production DB Server: MariaDB + PhpMyAdmin


Update Centos:

sudo yum update
sudo yum install nano wget

DB Server

sudo yum install httpd php php-mysql

sudo service httpd start
sudo systemctl enable httpd

Install MariaDB
Add MariaDB Repo

sudo nano /etc/yum.repos.d/MariaDB.repo

Put this inside MariaDB.repo

# MariaDB 10.1 CentOS repository list - created 2016-06-07 15:06 UTC
name = MariaDB
baseurl =

Install and Start Maria DB

sudo yum install MariaDB-server MariaDB-client

sudo service mariadb start
sudo systemctl enable mariadb

Securing Maria DB

sudo /usr/bin/mysql_secure_installation

Installing PHP MyAdmin

sudo yum install epel-release

sudo yum install phpmyadmin

PhpMyadmin Configuration

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

Change Php MyAdmin URL

Alias /NePhpMyAdminUrl /usr/share/phpMyAdmin

To allow access from All add Require all granted

   Require all granted
   Require ip
   Require ip ::1

Restart Web Server

sudo service httpd restart


[SOLVED] Laravel 5.1 Nginx/Apache: Can’t display errors, 500 internal server error


Edit index.php in public folder.

put all code inside try .. catch …


try {

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make('Illuminate\Contracts\Http\Kernel');

$response = $kernel->handle(
	$request = Illuminate\Http\Request::capture()


$kernel->terminate($request, $response);

} catch(\Exception $e) {
    echo "<pre>";
    echo $e;
    echo "</pre>";

[Solved] Laravel Storage Permission Denied even chmod 777


By default, SELinux will block the ability for Apache/webapps to write to files in RHEL/Centos. This is a security feature to limit what folders Apache can write to. You can notice this issue if you get errors in your Apache/Nginx such as:

PHP Warning:  move_uploaded_file(): Unable to move ‘/path/to/upload/…’ to ‘…….’

Command to set permissions:

chcon -R -t httpd_sys_rw_content_t <folder_name>

You can check the SELinux permissions via the following command:

ls -halZ

If You get Laravel Storage Permission Denied even chmod 777 there is posibility it is caused by SELinux mode in the server. SELinux was enabled which prevent Apache/Nginx to write files even with 777 mode.


 sudo setenforce 0

This should allow writing to storage directory, If permission denied gone, this prove SELinux is the problem. Turn SELinux back

setenforce 1

Then finally use SELinux to allow writing of the file by using this command

chcon -R -t httpd_sys_rw_content_t storage

And you’re off!

Changing Primary Domain Document Root in Cpanel

  1. Login to ssh.
  2. sudo and edit this file:

    If you have SSL:


    user is your cpanel username and domain is your domain, _SSL capital leter.

  3. Change these 2 line to your new document root:
    documentroot: /home/USER/public_html


    path: /home/USER/public_html/cgi-bin
  4. Run sudo:
    sudo /scripts/rebuildhttpdconf
    sudo service httpd restart
  5. Done.