How To Install Php And Mysql On Windows 7
LAMP is the acronyms of Linux, Apache, MySQL and PHP. Apache is the web server to serve files over HTTP protocol. MySQL is the popular database server. PHP is the programming linguistic communication used for developing web applications. Using these applications, we tin create a total fledged web server. The most common way to run PHP applications with Apache is the utilize of mod_php module. Also the good alternative is to apply PHP-FPM, which has several advantages over this. The default installation on CentOS 8 uses PHP-FPM to process php files.
This tutorial will help y'all to install and configure LAMP (Linux, Apache, MySQL and PHP) on CentOS 8 and RHEL 8 Linux systems.
Useful link:
- Setup Let's Encrypt SSL with Apache on CentOS 8
- How to Setup SFTP only user on CentOS 8
Prerequisites
- Newly installed CentOS 8 machine.
- Complete initial server setup
- Beat access with sudo privileges
Footstep 1 – Install Apache
The Apache spider web server packages are available under the default AppStream repository on CentOS eight. Yous merely need to update the DNF cache and install packages using the following commands.
sudo dnf update sudo dnf install httpd httpd-tools
The mod_ssl package provides the functionality to utilise an SSL document for secure HTTP. After installation, enable the httpd service and start.
sudo systemctl enable httpd.service sudo systemctl first httpd.service
Now check the Apache service status:
sudo systemctl condition httpd.service
Output:
● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d └─php-fpm.conf Agile: agile (running) since Sat 2020-03-22 04:27:24 EDT; 5s ago Docs: man:httpd.service(viii) Principal PID: 8644 (httpd) Status: "Started, listening on: port 80" Tasks: 213 (limit: 8918) Retention: 21.5M CGroup: /organization.piece/httpd.service ├─8644 /usr/sbin/httpd -DFOREGROUND ├─8650 /usr/sbin/httpd -DFOREGROUND ├─8651 /usr/sbin/httpd -DFOREGROUND ├─8652 /usr/sbin/httpd -DFOREGROUND └─8653 /usr/sbin/httpd -DFOREGROUND Mar 22 04:27:23 tecadmin systemd[ane]: Starting The Apache HTTP Server... Mar 22 04:27:24 tecadmin systemd[ane]: Started The Apache HTTP Server. Mar 22 04:27:24 tecadmin httpd[8644]: Server configured, listening on: port lxxx
Step 2 – Install MySQL Server
The latest MySQL eight packages are bachelor under the AppStrem repository nether CentOS 8. Use the following command to install MySQL server including required packages on your system.
sudo dnf -y install @mysql
Later completing the installation, enable the MySQL service to auto-start on the system start. As well kickoff service manually for the first fourth dimension.
sudo systemctl enable mysqld.service sudo systemctl start mysqld.service
And so check the service current status using the post-obit control:
sudo systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server Loaded: loaded (/usr/lib/systemd/organisation/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2020-03-22 02:49:33 EDT; 5min ago Process: 5841 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) Process: 5706 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, condition=0/SUCCESS) Process: 5682 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Main PID: 5798 (mysqld) Status: "Server is operational" Tasks: 38 (limit: 8918) Memory: 442.1M CGroup: /organisation.slice/mysqld.service └─5798 /usr/libexec/mysqld --basedir=/usr Mar 22 02:48:42 tecadmin systemd[1]: Starting MySQL viii.0 database server... Mar 22 02:48:45 tecadmin mysql-prepare-db-dir[5706]: Initializing MySQL database Mar 22 02:49:33 tecadmin systemd[1]: Started MySQL eight.0 database server.
The MySQL installation has been completed. Now yous can connect the MySQL server without whatever password but we recommend securing the MySQL installation. The MySQL packages provide mysql_secure_installation control to apply the security. Just run the below command on terminal:
sudo mysql_secure_installation
and follow the on-screen instructions. Below are the details which require user input.
- Printing y|Y for Yes, any other key for No: y
- Please enter 0 = Depression, i = MEDIUM and 2 = Strong: 2
- New password: [ENTER STRONG Password Here]
- Re-enter new password: RE ENTER PASSWORD Here
- Do you lot wish to proceed with the password provided?(Printing y|Y for Yep, whatsoever other central for No) : y
- Remove anonymous users? (Press y|Y for Yes, whatever other key for No) : y
- Disallow root login remotely? (Press y|Y for Yep, any other key for No) : y
- Remove exam database and access to it? (Press y|Y for Yep, any other key for No) : y
- Reload privilege tables now? (Press y|Y for Yes, whatever other primal for No) : y
Stride 3 – Install PHP
The Remi repository contains the latest PHP packages for the CentOS viii Linux system. So first of all, you lot need to add the REMI repository to your system. Simply execute the post-obit command to add together the repository.
sudo dnf install dnf-utils http://rpms.remirepo.internet/enterprise/remi-release-8.rpm
Then enable the required DNF module for PHP installation. Hither we are enabling the module for installing PHP 7.4. You tin change this to PHP 7.3 or PHP 7.ii as per your requirements.
sudo dnf module reset php sudo dnf module enable php:remi-7.four
In one case the repository is enabled on your system. Install PHP packages along with required PHP modules.
sudo dnf install php php-mysqlnd
You many besides need to install other required php modules as per your application requirements. The below command will install few frequently used php modules:
dnf install php-gd php-zip php-mcrypt php-json php-xml php-gettext php-curl php-intl
Stride iv – Create Apache VirtualHost
All the packages required for LAMP environment is installed. Now, create the Apache virtual host. By default the Apache uses php-fpm for processing PHP files on CentOS 8 system.
Create and edit virtual host configuration file in the favorite text editor:
sudo vim /etc/httpd/conf.d/tecadmin.example.net.conf
Add the following content in the configuration file. Brand sure to change required parameters.
< VirtualHost *:lxxx > ServerAdmin admin @ example . com DocumentRoot /var/www/html ServerName tecadmin . case . net ServerAlias www . tecadmin . case . net ErrorLog logs/tecadmin . cyberspace-error . log CustomLog logs/tecadmin . net-access . log combined < /VirtualHost > |
Save the virtual host configuration file and reload Apache to utilize changes.
sudo systemctl restart httpd.service
Useful link:
- Setup Let'south Encrypt SSL with Apache on CentOS viii
Step v – Allow Ports in Firewalld
The CentOS 8 Linux server is ready to serve the application over LAMP environment. If your system has firewalld installed ans agile, you demand to permit Apache ports. This will allow network users to admission web awarding from remote systems.
The following commands will open the required ports for yous.
sudo firewall-cmd --zone=public --permanent --add-service=http sudo firewall-cmd --zone=public --permanent --add-service=https sudo firewall-cmd --reload
Useful link:
- What is FirewallD and how to implement on Linux
Step 6 – Test Setup
All done. To test the environs, create a PHP script with phpinfo() part. Place this file to your server certificate root. Use the beneath command to practise this.
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Then access info.php using server IP accost (for default VirtualHost) for your configured domain in Apache VirtualHost.
http://tecadmin.example.internet/info.php
Decision
You have successfully configured LAMP environment on your CentOS 8 or RHEL viii Linux system. Next y'all can install phpMyAdmin on your system.
Source: https://tecadmin.net/install-lamp-centos-8/
Posted by: kellywalway.blogspot.com
0 Response to "How To Install Php And Mysql On Windows 7"
Post a Comment