Skip to content

Instantly share code, notes, and snippets.

View smohadjer's full-sized avatar

Saeid Mohadjer smohadjer

View GitHub Profile
@smohadjer
smohadjer / .htaccess
Last active May 3, 2020 15:44 — forked from man-oi/.htaccess
htpasswd
AuthType Basic
AuthName "only for valid users"
AuthUserFile /full/path/.htpasswd
Require valid-user
// If you don't have ssh access to your site, put the following command in a php file and upload it to your server to find out the full path to .htpasswd:
<?php echo realpath('./') . PHP_EOL; ?>
// You can create a .htpasswd using terminal:
htpasswd -c .htpasswd username
@smohadjer
smohadjer / php.md
Last active August 16, 2021 11:30
PHP

Use var_dump() to echo a variable: https://www.php.net/manual/en/function.var-dump.php

Updating PHP version of terminal using .bash_profile

The version of PHP available from the command line has nothing to do with the version of PHP loaded as a module. These are completely separate things. The version you see in browser when you run phpinfo() is the version Apache is using and the version you see when you run which php in cli is the version command line is using. If after upgrading to a new version of php typing php --version in terminal still shows old version of php you need to update the php path of your $PATH variable which we do using .bash_profile. This is a hidden file in your Mac’s user directory which is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. Take note that Bash shell uses colon (:) as the path separator; while windows use semicolon (;).

  1. Find the php folder where new version of php i
@smohadjer
smohadjer / MariaDB.md
Last active July 25, 2023 17:25
MariaDB