Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fresh PHP 8.0 LEMP setup info/Ubuntu 16
## Requires newer versions of ubuntu, I'm using Ubuntu 20
# install nginx
sudo apt install nginx
# add php8.X repository
sudo add-apt-repository ppa:ondrej/php
sudo apt update
# search libraries
sudo apt search php8-*
# install libraries
sudo apt install php8.0-fpm php8.0-common php8.0-curl php8.0-mysql php8.0-gd php8.0-intl php8.0-mbstring php8.0-xml php8.0-zip php8.0-opcache php8.0-tidy php8.0-readline php8.0-imagick
# extra packages
imagemagick beanstalkd supervisord zip
# install memcache
sudo apt install libmemcached-dev memcached php-memcached
# install mysql
sudo apt install mysql-server
sudo mysql_secure_installation
# setup virtual host
cd /etc/nginx/sites-available && sudo touch server.dev
# nginx file
server {
listen 80;
root /var/www/server.dev/public_html;
index index.php index.html index.htm;
server_name server.dev;
sendfile off;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# system link
sudo ln -s /etc/nginx/sites-available/server.dev /etc/nginx/sites-enabled/server.dev
# install composer
cd /tmp
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
@exts

This comment has been minimized.

Copy link
Owner Author

@exts exts commented Feb 27, 2020

Mysql: fix access issue when using vagrant

sudo mysql

use mysql;`
update user set plugin='mysql_native_password' where user = 'root';
flush privileges;
@exts

This comment has been minimized.

Copy link
Owner Author

@exts exts commented May 27, 2021

update mysql.user 
    set authentication_string=PASSWORD("PWD"), plugin="mysql_native_password" 
    where User='root' and Host='localhost';    
flush privileges;

To fix connection issues w/ root

@exts

This comment has been minimized.

Copy link
Owner Author

@exts exts commented Oct 11, 2021

MYSQL 8.X password fix:

UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment