03.1: Install Apache and MySQL
Before we can start making web pages with PHP, we need to install Apache and MySQL. PHP is a very popular scripting language. There are many supported operating systems, web servers, and databases. There are too many to cover in one lesson. We will only look at Apache and MySQL on Linux.
Though Chapter 3 we will create a simple user login page using MySQL as a back-end. We will do that in small building blocks. This episode is the first part of that series.
# * From the Linux command line: # * Install Apache yum install -y httpd service httpd start systemctl enable httpd.service firewall-cmd --add-service=http --permanent firewall-cmd --add-service=https --permanent firewall-cmd --reload # * Install PHP and connectors. yum install -y php php-common php-mysqlnd # Note: The above command is for Fedora. For CentOS install "php-mysql" not "php-mysqlnd". # * Install MySQL (We will be using the free mariadb version of MySQL.) yum install mariadb-server mariadb systemctl start mariadb systemctl enable mariadb.service # * Configure the initial MySQL installation mysql_secure_installation # * Create database and user. CREATE DATABASE friendplace; GRANT ALL ON friendplace.* TO 'fuser'@'localhost' IDENTIFIED BY '12345' WITH GRANT OPTION; FLUSH PRIVILEGES; exit # * Verify it is running correctly mysql -u fuser -p friendplace SHOW DATABASES; exit