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 php environment on CVM

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

Share

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

How do I install a php environment on a CVM? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

To install php environment configuration with a CVM, you must first purchase a CVM; then use a remote link to log in to the server to build the environment; upload the project, configure the apache; environment, register the domain name, file and resolve, and so on.

After the CVM is purchased successfully, a public network IP and a private network IP will be generated. Here we focus on how to build a running environment.

1. The centOS system can directly use the yum install command to install the environment, and the more stable version can directly use the command:

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

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

Service httpd start

Service mysqld start

Service php-fpm start

After the input of the above three commands, the environment of the website is basically completed. You can check the operation of the previous services. Command: netstat-tunlp

Php-fpm listens to port 9000, mysqld listens to port 3306, httpd listens to port 80, and has been started normally. If you open the browser if the server's public network IP, you can see the test page of apache.

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

Change the X in the double quotation marks to the password you want to set, log in to the database to view it after the setting is complete, and use the command: mysql-u root-p

Enter prompts you to enter your password and enter the password you just set to enter the database.

3. Upload the project you have prepared (this step requires that you have registered the domain name, and if you test it, you can use the public network IP to access it in the browser):

After setting up the environment, you can upload your project directly to the / var/www/html directory. It should be mentioned here that only root users have write permissions in the html directory, so you need to modify the html directory permission to 777. Command: chmod-R 777 / var/www/html

After the permission modification is completed, you need to find the apache configuration file: / etc/httpd/conf/httpd.conf file, and add a code at the end of the file after opening it:

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot / var/www/html/ project root directory

ServerName / / domain name

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

Restart apache:service httpd restart by modifying DocumentRoot and ServerName.

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

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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