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-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to install PHP+Apache+Mysql server environment on CentOS", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn how to install PHP+Apache+Mysql server environment on CentOS!

1: Install MySQL

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

2. The requested URL/etc/init.d was not found on this server.

3. Set the initial password of mysql (no password by default after mysql installation is completed, and a warning message will appear before starting mysql without setting a password)

Password setting method: assume 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)

Login mysql: mysql -u root -p

Enter the password (password is invisible, enter directly)

Assign a remote connection account using the following command

mysql> grant all privileges on *.* to 'username'@'remote address' identified by 'password' with grant option;mysql> flush privileges;

2: Install Apache

yum install httpd httpd-devel

After installation, do not rush to start, first complete the following php installation steps

3: Install PHP and Plugins

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

4: Start Apache

/etc/init.d/httpd start

So far, the php+apache+mysql server environment has been set up.

Set Apache httpd service boot: chkconfig httpd on

Set mysql service startup: chkconfig mysqld on

After apache installation is completed, the default path of the root directory is/var/www/html/. At this time, php files such as index.php can be created in these directories. Enter the code:

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

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

Here is a simple way to determine if port 80 is blocked by a firewall.

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

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

At this point, I believe that everyone has a deeper understanding of "how to install PHP+Apache+Mysql server environment on CentOS", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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

Internet Technology

Wechat

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

12
Report