TS 2585 TypeScript compile error: ‘Promise’ only refers to a type, but is being used as a value here
Upgrade (cleanly) from PHP 7.0 to PHP 7.1
Invoice Ninja Ubuntu – PHP 7.0 upgrade guide.
PHP 7.0 is now EOL, so time to upgrade!
You could move straight up to the latest PHP which at the time of writing is 7.2, however for our application stack, we will only be moving to 7.1
The first thing that needs to be done is all your NGINX configs need to point to the new FPM process, simply sed the conf files replacing 7.0 with 7.1
find . -type f -exec sed -i 's/7.0/7.1/g' {} \;
Next install all the required PHP libs
sudo apt install php7.1 php7.1-bz2 php7.1-cli php7.1-common php7.1-curl php7.1-fpm php7.1-gd php7.1-gmp php7.1-intl php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache php7.1-readline php7.1-xml php7.1-xmlrpc php7.1-zip
Now lets start up the 7.1 service
sudo service php7.1-fpm start
Lets restart NGINX so that it picks up the new PHP 7.1 fpm process
sudo service nginx restart
And now lets get rid of the old PHP version
sudo apt-get purge php7.0 php7.0-common
Bonus points –
Remember your PHP version is now referencing a new PHP.ini file… make sure you bring across all your required changes such as session handlers etc etc
sudo vim /etc/php/7.1/fpm/php.ini [Session] session.save_handler = redis session.save_path = "tcp://redis_server_here"
add data to session variables laravel
Auth::user()->setAttribute('key','value');
unset(Auth::user()->key);
reference:
https://stackoverflow.com/questions/29190058/laravel-add-and-remove-auth-session-variables
Compound Indexes
drop index INDEX_NAME on TABLE_NAME;
ALTER TABLE TABLE_NAME add index INDEX_NAME(col1, col2);
SHOW INDEX FROM yourtable;
git squash – cleanly
git reset –soft $(git merge-base develop elasticsearch) && git commit -am “Full text search with Laravel Scout” && git rebase -i develop
Ansible apt update
ansible web -m apt -a "upgrade=yes update_cache=yes cache_valid_time=86400" -u david -K --become
search and replace from the command line
ack-grep -l --print0 "$@" "$FROM_STRING" | xargs -0 -n 1 sed -i -e "s/$FROM_STRING/$TO_STRING/g"
Xdebug remote server
https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel
SSH tunnel is the crucial part!
Laravel sniff DB query builder
DB::listen(function ($query) {
// $query->sql
// $query->bindings
// $query->time
});
MariaDB replication with GTID
Improves resiliency of replication in case of primary crash
https://mariadb.com/resources/blog/enabling-gtids-server-replication-mariadb-100
Recent Comments