PHP server cmd command

Updated: 6th February 2020
Tags: php

PHP server in current directory

php -S localhost:8000

PHP server in public directory

php -S localhost:8000 -t public

PHP Simple PDO class

Updated: 23th December 2019
Tags: php mysql sql

Laravel select random row from table

Updated: 22th December 2019
Tags: php laravel sql

Get randow row from table in laravel 5.3+

$randomRow = DB::table('table')
            ->inRandomOrder()
            ->first();

Get randow id from table in laravel 5.3+

$randomId = DB::table('table')
            ->inRandomOrder()
            ->value('id');

Increase laravel performance

Updated: 20th December 2019
Tags: php laravel

Update laravel/installer global

Updated: 20th December 2019
Tags: php composer laravel

Laravel fresh install ubuntu HTTP 500 Fix

Updated: 18th December 2019
Tags: php laravel ubuntu

After installing laravel you MUST change some folder permissions.

sudo chmod 755 -R laravel_app
sudo chmod -R o+w laravel_app/storage
sudo chmod -R o+w laravel_app/bootstrap/cache

Install PHP 7.4 on Apache Ubuntu 18.04

Updated: 4th December 2019
Tags: php apache

Install PHP 7.4 on Nginx Ubuntu 18.04

Updated: 4th December 2019
Tags: php php-fpm nginx