There can be more that one scenario on how you are hosting your web application. They are: Scenario 1: You serve your website directly through apache web server without using any proxy server. Scenario 2: You serve your website through an NGINX based front-proxy server and on the back-end the application is running on apache … Continue reading Installing cloudflare certificate on origin server
Using NGINX as load balancer and scaling apache using docker-compose
Overview: The main approach here is to use NGINX as a load balancer to distribute load between multiple instance of apache server propped up using docker-compose. Here the NGINX will be handing all the traffic through port 80 and distributing it throughout the different available replicas of the apache server. Our approach is to serve … Continue reading Using NGINX as load balancer and scaling apache using docker-compose
Paginating custom collections in laravel
In order to be able to paginate custom collections created in laravel using the collection() method add the following code in the AppServiceProvider.php if (!\Illuminate\Support\Collection::hasMacro('paginate')) { \Illuminate\Support\Collection::macro('paginate', function ($perPage = 15, $page = null, $options = []) { $page = $page ?: (Paginator::resolveCurrentPage() ?: 1); return (new \Illuminate\Pagination\LengthAwarePaginator( $this->forPage($page, $perPage)->values()->all(), $this->count(), $perPage, $page, $options)) ->withPath(''); … Continue reading Paginating custom collections in laravel
Running multiple websites on a VPS using docker and NGINX reverse proxy
It is possible to run multiple websites running on difference instances of docker using different ports. The NGINX server will listen on port 80 and forward to appropriate docker instance and port based on the domain name. One approach of getting to this is to install NGINX server and manually configure this to forward to … Continue reading Running multiple websites on a VPS using docker and NGINX reverse proxy
Laravel simple local development environment setup
Often times we need to setup an instance of a laravel framework for some small project or proof of concept ideas. It's ideal if we could do it without having to setup a docker instances just for it or not having to maintain a local lamp stack just for these projects. If you are like … Continue reading Laravel simple local development environment setup
Linux: Switching PHP version in Apache
Make sure the repository link is added to the source list before trying to install. Now install the PHP version you want to install. Install the common extensions For apache install the module. After module of PHP is installed disable the existing version in apache and enable the targeted version. To set default CLI php … Continue reading Linux: Switching PHP version in Apache
2020: Making CodeIgniter Modular
This is an implementation that I did recently using CodeIgniter framework for a project. It uses the default implementation of CodeIgniter and adds modularity. Out of the box CodeIgniter framework has `application` and `system` folder at the root. We will use multiple copies of the `application` folder as separate modules which will share the same … Continue reading 2020: Making CodeIgniter Modular
Laravel Quarks
If you are using redirect() inside the any custom class you have to call send() after redirect(). Example: redirect()-send();
CKFinder integration on Laravel 5.8
This post is for self reference to issues faced while setting up CK finder on CK editor version 5.0+. I hope this will also help people facing similar situation while trying to integrate - 1. "Invalid Request" : When using the finder based uploader, after selecting the file it shows an invalid request popup and … Continue reading CKFinder integration on Laravel 5.8
Is CodeIgniter obsolete
Most web application developer who are involved in PHP based development must be aware of CodeIgniter framework. It is a hugely popular framework, specially amongst developers who are just starting out on MVC pattern based development. But with introduction of more recent frameworks such as Laravel and Symfony, there seems to be a downward trend … Continue reading Is CodeIgniter obsolete