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 deploy php on CVM centOS

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly explains how to deploy php in Cloud Virtual Machine centOS. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "How to deploy php in Cloud Virtual Machine centOS"!

How to deploy PHP? php is a language environment we often use, especially under Linux systems. When configuring php environment, different Cloud Virtual Machine may operate differently. Cloud Virtual Machine

1, centOS system can be installed directly using the yum install command environment, more stable version can be directly used command:

yum install -y httpd php php-fpm mysql mysql-server php-mysql

After installation, you need to start all services in turn, and enter the following commands in turn:

service httpd startservice mysqld startservice php-fpm start

After the above three commands are input, the environment of the website is basically completed. You can check the operation of various services first. Command:

netstat -tunlp

php-fpm listens on port 9000, mysqld listens on port 3306, httpd listens on port 80, and it has been started normally; at this time, if you open the browser, you can see the apache test page if you open the server's external IP.

2. Modify the database password of the cloud host by using the command mysql admin -u root password "XXXXXXXX"

Change the X in double quotes to the password you want to set. After setting, log in to the database to view it. Use the command:

mysql -u root -p

Enter prompt you to enter the password, enter the password you have just set can enter the database.

3. Upload your prepared project (this step requires that you have registered the domain name, if not registered, you can register it in 56 Cloud, and the test can be accessed by using the external network IP in the browser):

After the environment is built, you can upload your project directly to the/var/www/html directory. Here, it needs to be mentioned that only the root user has write permission in the html directory, so you need to modify the html directory permission to 777. Command:

chmod -R 777 /var/www/html

After the permissions are modified, you need to find the apache configuration file:/etc/httpd/conf/httpd.conf file. After opening it, add a paragraph of code at the end of the file:

ServerAdmin webmaster@dummy-host.example.comDocumentRoot /var/www/html//project root ServerName//domain ErrorLog logs/dummy-host.example.com-error_logCustomLog logs/dummy-host.example.com-access_log common

Modify DocumentRoot and ServerName accordingly, restart apache:

service httpd restart

Here the website can be accessed normally, open the browser and enter the domain name to open your own website.

At this point, I believe everyone has a deeper understanding of "how to deploy php in Cloud Virtual Machine centOS," so let's 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

Database

Wechat

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

12
Report