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 centos yum and build php environment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "centos yum how to install and build php environment", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly, together to study and learn "centos yum how to install and build php environment"!

Operating environment: centOS8, PHP 7.2, DELL G3

Centos8 installation build php environment

After installing the window/centos dual system, set up the php environment on centos.

There are also many installation tutorials on the Internet, in fact, all the same, the following I directly use yum installation. The default is to install the latest version.

Install apache:

yum install httpd//Configure ServerName//Modify #ServerName www.example.com:80 to ServerName localhost:80vi /etc/httpd/conf/httpd.conf//Start apache: systemctl start httpd//View installation version: (mine is apache/2.4.37) httpd -v//Set boot: systemctl enable httpd

Install mysql:

yum install mysql mysql-server//start mysqlsystemctl start mysqld.service//set root password to 123456mysqladmin -u root password 123456//subsequent if you need to modify root password alter user 'root'@'%' identified with mysql_native_password by ' new password';//login mysqlmysql -u root -p //password required//set remote access grant all privileges on *.* to 'root'@'%'with grant option;flush privileges;//If remote is still inaccessible, it may be due to firewall, turn off firewall//here you can check that root user's host 'localhost' has changed to '%'use mysql select host,user from user;

Install php:

yum install php php-devel//View php version php -v//install php extension yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc//I will prompt an error when installing php-mysql here: no matching parameters: php-mysql//solution is as follows: yum search php-mysql//found two matching versions: php-mysqlnd.x86_64 ; Execute install yum install php-mysqlnd.x86_64//start phpsystemctl start php-fpm//set boot startup systemctl enable php-fpm

Finally restart apache: systemctl restart httpd. The environment has been completely installed here.

Apache default parsing directory is under/var/www/html directory, change to/var/www directory

vim /etc/httpd/conf/httpd.conf

Change from Root "var/www/html/" to "var/www/"

Restart Apache:

systemctl restart httpd

Testable: Create a new file index.php under/var/www/browser direct access: localhost will display the contents of index.php

Set up multi-site: create a.conf file under/etc/httpd/conf.d/directory; create a new website directory under the corresponding/var/www/directory

cd /etc/httpd/conf.d/ touch test.conf//test.conf Insert the code DocumentRoot /var/www/test ServerName www.test.com Require all granted Options FollowSymLinks AllowOverride all #Require all denied

The client hosts specifies the IP address and domain name, and you can access the website normally. (For example 192.168.2.144 www.test.com)

Thank you for reading, the above is "centos yum how to install and build php environment" content, after learning this article, I believe we have a deeper understanding of how to install centos yum php environment, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Development

Wechat

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

12
Report