Skip to content

Instantly share code, notes, and snippets.

View huzaifaarain's full-sized avatar
🏠
Working from home

Muhammad Huzaifa huzaifaarain

🏠
Working from home
View GitHub Profile
@huzaifaarain
huzaifaarain / nginx_fastcgi_errors.md
Created December 6, 2023 20:55 — forked from CMCDragonkai/nginx_fastcgi_errors.md
NGINX: Common FastCGI Errors involving PHP-FPM

Common FastCGI Errors involving PHP-FPM

  1. 504 Gateway Timeout

    upstream timed out (110: Connection timed out) while reading response header from upstream
    

Means NGINX timed out reading the HTTP response header from upstream. This

@huzaifaarain
huzaifaarain / docker-php-ext-install.md
Created August 26, 2022 07:51 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@huzaifaarain
huzaifaarain / .php-cs-fixer.php
Created February 28, 2022 19:30 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@huzaifaarain
huzaifaarain / .php-cs-fixer.php
Created February 28, 2022 19:29 — forked from pktharindu/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
@huzaifaarain
huzaifaarain / Response.php
Created November 30, 2021 08:28 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@huzaifaarain
huzaifaarain / Readme.md
Created June 22, 2021 19:24
Laravel Directory Permission

Webserver as owner (the way most people do it, and the Laravel doc's way):

assuming www-data (it could be something else) is your webserver user.

sudo chown -R www-data:www-data /path/to/your/laravel/root/directory

if you do that, the webserver owns all the files, and is also the group, and you will have some problems uploading files or working with files via FTP, because your FTP client will be logged in as you, not your webserver, so add your user to the webserver user group:

@huzaifaarain
huzaifaarain / .htaccess
Created May 19, 2021 11:16
Remove public from URL Laravel 7.x including sub directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
@huzaifaarain
huzaifaarain / 2019-https-localhost.md
Created May 12, 2021 19:26 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@huzaifaarain
huzaifaarain / query.sql
Created May 10, 2021 20:40
Update WP Links In Database After Migration
SET @oldUrl = "Existing URL" COLLATE utf8mb4_unicode_520_ci;
SET @newUrl = "New URL" COLLATE utf8mb4_unicode_520_ci;
UPDATE wp_options SET option_value = replace(option_value, @oldUrl, @newUrl) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldUrl, @newUrl);
UPDATE wp_postmeta SET meta_value = replace(meta_value,@oldUrl, @newUrl);
UPDATE wp_usermeta SET meta_value = replace(meta_value, @oldUrl, @newUrl);
@huzaifaarain
huzaifaarain / Chapter7_CommandLineOperations.md
Last active April 26, 2021 21:34
Introduced commands in Linux Foundation LFS101x Course

Chapter 7: Command Line Operations

Viewing Files

cat Used for viewing files that are not very long; it does not provide any scroll-back.

tac Used to look at a file backwards, starting with the last line.

less Used to view larger files because it is a paging program. It pauses at each screen full of text, provides scroll-back capabilities, and lets you search and navigate within the file. Note: Use / to search for a pattern in the forward direction and ? for a pattern in the backward direction. An older program named more is still used, but has fewer capabilities: "less is more".