Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and build the server environment of PHP+Apache+Mysql on CentOS

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install and build a PHP+Apache+Mysql server environment on CentOS. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora and RedHat as well as in CentOS. Based on RPM package management, RPM packages can be downloaded and installed automatically from designated servers, dependencies can be automatically dealt with, and all dependent software packages can be installed at one time without tedious downloading and installation.

The following installation process is based on using yum to install and build the server environment of PHP+Apache+Mysql under centos

One: install MySQL

1. Install yum install mysql mysql-server mysql-devel

two。 Start MySQL / etc/init.d/mysqld start

3. Set the MySQL initial password (the default is no password after the Mysql installation is completed. A warning message will appear when starting mysql before setting the password)

Password setting method: assume that the password is set to 123456

Mysqladmin-u root password 123456

4. Set remote login permissions (if you need to connect to MySQL remotely, do the following)

Log in to MySQL:mysql-u root-p

Enter the password (password is not visible, just enter it directly)

Use the following command to assign a remote connection account

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'username' @ 'remote address' IDENTIFIED BY 'password' WITH GRANT OPTION;mysql > FLUSH PRIVILEGES

Two: install Apache

Yum install httpd httpd-devel

After the installation is complete, there is no need to rush to start, first complete the following installation steps for PHP

Three: install PHP and plug-ins

Yum install php php-mysql php-common php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

Four: start Apache

/ etc/init.d/httpd start

So far, the server environment for PHP+Apache+Mysql has been set up.

Set the httpd service boot of Apache to start: chkconfig httpd on

Set MySQL service boot startup: chkconfig mysqld on

After the Apache installation is completed, the default path of the root directory is / var/www/html/,. You can create PHP files such as index.php in some directories at this time, and enter the code:

Use a browser to access the server IP. If the configuration is successful, you will see the following page:

If there is no exception in the above steps, but the page cannot be accessed, please check the firewall policy on the premise of ensuring that the address you entered is correct.

The following provides a simple way to determine whether port 80 is blocked by a firewall.

Turn off the firewall service (it is not recommended to close the firewall policy after the server is put into use): service iptables stop

After the firewall service is turned off, try again to see if you can access it properly.

This is the end of the article on "how to install and build a server environment for PHP+Apache+Mysql on CentOS". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report