Skip to content

Instantly share code, notes, and snippets.

@addeeandra
Last active April 11, 2020 11:13
Show Gist options
  • Save addeeandra/9a71ed1bb7d0a31ef02c1d65466dce23 to your computer and use it in GitHub Desktop.
Save addeeandra/9a71ed1bb7d0a31ef02c1d65466dce23 to your computer and use it in GitHub Desktop.
Common PHP & Mysql Setup Command in Ubuntu
# in case u need it (common)
sudo apt-get install curl wget unzip
# install mysql
sudo apt-get install mysql-server
# setup mysql
sudo mysql_secure_installation
# Optional step - if mysql can't login using other users
# https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04
# Option step - create user other than root
# https://stackoverflow.com/questions/1720244/create-new-user-in-mysql-and-give-it-full-access-to-one-database
# install PHP
sudo apt-get install php libapache2-mod-php php-mysql php-xml php-mbstring php-zip php-gd php-imagick
# by default, apache first look into index.html, prefer to index.php
sudo nano /etc/apache2/mods-enabled/dir.conf
# restart apache2 and see its status
sudo systemctl restart apache2
sudo systemctl status apache2
sudo apachectl configtest # do apache2 config test
# see available PHP modules
sudo apt-cache search php- | less
# see more detailed information -> 'apt-cache show package_name'
sudo apt-cache show php-cli
# certbot for APACHE
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-apache
# your_domain.conf -> ServerName www.your_domain
sudo certbot --apache -d your_domain -d www.your_domain
# installing Composer here : https://getcomposer.org/download/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment