Last active
November 30, 2023 06:02
-
-
Save exts/e097fb92db8dda6ddabfc35302b687ea to your computer and use it in GitHub Desktop.
Fresh PHP 8.0 LEMP setup info/Ubuntu 16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
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
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 'root';
UNINSTALL COMPONENT 'file://component_validate_password'; antoer alternative
RUN THIS BEFORE:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'root';
sudo mysql_secure_installation -p
using the password
THEN say no to changing the root pw. and no to security check
mysql server needs at least 1GB or it won't work on digitalocean
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mysql: fix access issue when using vagrant
sudo mysql