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

The method of installing Apache+MySQL+PHP in CentOS6.4

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces the relevant knowledge of "the method of installing Apache+MySQL+PHP in CentOS6.4". The editor shows you the operation process through the actual case. The method of operation is simple, fast and practical. I hope this article "the method of installing Apache+MySQL+PHP in CentOS6.4" can help you solve the problem.

Install mysql

Use the yum command to download mysql software, the installation is to root permission, su this command can get permission.

[root@centos6 administrator] # yum install mysql-server

Start the command with the system:

Chkconfig-levels 235 mysqld on

Enter the following:

/ etc/init.d/mysqld start

Command to start the database

And then we're setting the password for mysql.

Enter:

Mysql_secure_installaution

When there is enter current password for root, we enter.

Enter again as follows: set root password? [y/n]

He will appear new password: ask you to enter a new password:

When the password is set, he will appear 4 times to confirm, press enter.

Install apache components

Apache software has been packaged in centos and can be installed directly.

Enter the command:

Yum install httpd

If is this ok appears, type y and enter enter.

The next step is to set it to boot, with the following command:

Chkconfig-levels 235 httpd on

When the above is done, start apache. The command is as follows:

/ etc/init.d/httpd start

At this time, you can access your server, you can enter the address and port on the browser to check, there will be apache 2 test page powered by centos shows that you are successful, congratulations! As shown in the figure below, my server has done port mapping, so it is port 44444.

Note: the default root directory for apache in centos is / var/www/html, and the configuration file / etc/httpd/conf/httpd.conf. Other configurations are stored in the / etc/httpd/conf.d/ directory. Note that the firewall is off or set to allow.

Install php

Enter the following command to install php:

Yum install php

Next let's restart the apache service:

/ etc/init.d/httpd restart

Let's see if php works.

Let's change to the root directory of apache / var/www/html/ command as follows: (ls is the command to view files and folders in the directory)

Cd / var/www/html

Use the vim editor to write a test file for php

The command is:

Vim info.php

This command creates a file at the end of php, and then presses the "I" key on the keyboard to edit the content as follows:

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