ctrl shift v to preview turn off double click to exit preview in visual studio code: File > Preferences > Settings > double click to...
sudo rm /var/www/html/*.phpsudo rm /var/www/html/*sudo systemctl stop apache2sudo apt install nginxsudo systemctl start nginxsudo systemctl enable nginxsudo apt install php php-fpm php-mysqlsudo apt install mysql-serversudo mysql_secure_installationsimply click 'enter' or skip every prompt
sudo nano /etc/nginx/sites-available/defaultnginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
*add in index.php above ^*
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
*uncomment this line*
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
*^uncomment this line, 8.1 should be the version of ur php, run php -v to check*
}
}
sudo nginx -tsudo systemctl reload nginxsudo mysql -u root -penter the below 3 queries:
CREATE DATABASE testdb;USE testdb;CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
description TEXT
);CREATE USER 'phpuser'@'localhost' IDENTIFIED WITH mysql_native_password BY '';GRANT ALL PRIVILEGES ON testdb.* TO 'phpuser'@'localhost';GRANT FILE ON *.* TO 'phpuser'@'localhost';FLUSH PRIVILEGES;TRUNCATE TABLE products;sudo apt-get install apparmor-utilssudo aa-complain /etc/apparmor.d/usr.sbin.mysqldsudo chown -R "student":www-data /var/www/htmlsudo chmod -R 777 /var/www/htmlsudo chmod g+s /var/www/htmlsudo nano /etc/mysql/mysql.conf.d/mysqld.cnfsecure-file-priv = /var/www/htmlsudo systemctl restart mysqlsudo mysql -u root -pcheck that it worked
SHOW VARIABLES LIKE 'secure_file_priv'; sudo nano /var/www/html/additem.htmlsudo nano /var/www/html/additem.phpsudo nano /var/www/html/viewitem.htmlsudo nano /var/www/html/viewitem.phpPaste the 4 scripts into their respective location