[lubuntu]lbuntu22.04安裝mysql8.1 +php5.6 +nginx

參考網址:https://cumi.co/20221006/

lubuntu 22.04
1.mysql
apt install mysql-server

更改mysql root 密碼
mysql mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;

取消mysql嚴格模式
vi /etc/mysql/my.cnf
新增
[mysqld]
sql_mode=""

service mysql restart
systemctl enable mysql


2.安裝php5.6
add-apt-repository ppa:ondrej/php
apt install -y php5.6
apt install php5.6-gd php5.6-mysql php5.6-imap php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php5.6-soap php5.6-opcache php5.6-common php5.6-json php5.6-readline php5.6-xml

3.安裝nginx
apt install php5.6-fpm php5.6-cgi -y
apt install php5.6-mysqli php5.6-mysql -y
apt install nginx unzip -y
vim /etc/nginx/sites-enabled/default

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	root /var/www/html;
	index index.php index.html index.htm index.nginx-debian.html;
	server_name _;

	location / {
	    try_files $uri $uri/ =404;
	}

	location ~ \.php$ {
	    include snippets/fastcgi-php.conf;
	    fastcgi_pass unix:/run/php/php5.6-fpm.sock;
	}
}


service apache2 stop
systemctl disable apache2
service nginx restart
systemctl enable nginx


vi /var/www/html/1.php
<?php
phpinfo();
?>

看看網頁的狀況如何

修改php.ini
/etc/php5.6-fpm/php.ini
修改完後得重啟php5.6-fpm
service php5.6-fpm restart

phpmyadmin php5.6得配合舊版的phpmyamdin
cd /var/www/html
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.11/phpMyAdmin-4.9.11-all-languages.zip
unzip phpMyAdmin-4.9.11-all-languages.zip
mv phpMyAdmin-4.9.11-all-languages phpmyadmin
cd phpmyadmin
cp config.sample.inc.php config.inc.php


安裝後試用結果,效能與apache2比較,似乎也沒有顯著提昇。

 

本篇發表於 Linux系統, 程式設計。將永久鏈結加入書籤。