Change public path in Laravel 5.*

Most shared host use public_html instead of public,
While sometimes considered bad practice, some client may force you to drop-in everything via FTP

There are several ways to change public folder name found on Google.

But most of them won’t work perfectly.

  1. In AppServiceProvider.php, bind ‘path.public’ to IoC container
    Won’t work in console, vendor:publish still publish in public path
  2. In index.php, bind ‘path.public’ to IoC container
    Works in console, but artisan serve still won’t work

After dig down deep in the source code, I found the cause:

The publicPath() method in Illuminate\Foundation\Application
is hardcoded.

public function publicPath()
    return $this->basePath.DIRECTORY_SEPARATOR.'public';

But we should never hard the core, so let’s override this method on our own class.

Continue reading “Change public path in Laravel 5.*”

Apache HTTPS Certificate Purchase and Installation

HTTPS Certificate Purchased from (Should work on other Cert Providers)
Installation on Ubuntu 14.04 / 16.04 + Apache 2.4
With Apache settings to harden SSL settings for better security.

Too lazy to research and type every time so put it here for my own copy-and-paste.

Continue reading “Apache HTTPS Certificate Purchase and Installation”

WAMP Development Machine Setup Note

Install vanilla Apache 2.4, PHP 7.0, MySQL 5.7 separately
Not using XAMPP because I don’t like their structure.
And they run PHP by Apache module, which cause bug and crash (Especially on Laravel).

For my own note (For copy and paste :D)

Updated 2017-05-03: Change to fastcgi setup to prevent Apache crashing

Continue reading “WAMP Development Machine Setup Note”