Skip to content

Instantly share code, notes, and snippets.

@samlovescoding
Created August 9, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samlovescoding/f5acdbb19b49e84eac44d68cf02f1a06 to your computer and use it in GitHub Desktop.
Save samlovescoding/f5acdbb19b49e84eac44d68cf02f1a06 to your computer and use it in GitHub Desktop.
Actually working Linux setup for PHP and MySQL.
# Update your system and its repositories
sudo apt-get update
sudo apt-get upgrade
# Install Apache Server
sudo apt-get install apache2
# Install MySQL Server
sudo apt-get install mysql-server
mysql_secure_installation
# Validate Password: n
# New Password: 123456
# Re Enter Password: 123456
# Remove anonymous users: y
# Disallow root login remotely: y
# Remove test database and access to it: n
# Reload privileges table: y
# Install PHP
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php libapache2-mod-php php-mysql
# Setup MySQL root user
sudo mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';
# Fix directory permissions
chown -R samlovescoding:samlovescoding /var/www
chmod -R 755 /var/www
# Put index.php before index.html if you want Apache2 to load index.php before index.html file.
sudo nano /etc/apache2/mods-enables/dir.conf
sudo service apache2 restart
# Install other PHP modules. Feel free to list your favorite modules. I'll add them if I feel they are common.
sudo apt-get install php-curl php-mbstring php-mcrypt
@samlovescoding
Copy link
Author

This is not a script you can download and run. Run each command one by one!
MySQL username: root
MySQL password: 12345678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment