In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to build a PHP server environment with CentOS". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to build a PHP server environment with CentOS".
1. Install apache first:
Yum install httpd
Configure servername
Vi / etc/httpd/conf/httpd.conf
Modify # servername www.example.com:80 to servername localhost:80
When the external machine enters the ip address of the server, you should see the service page of apache. The port does not need to be entered. Apache uses port 80 by default.
If it cannot be opened, external access may not be enabled at port 80. Check:
/ etc/init.d/iptables status
Whether there is 80 or other information behind it, if not, turn it on. Note that there are two middle bars in front of the position and sentence state,deport--:
Vim / etc/sysconfig/iptables
Join:
-an input-p tcp-m state-- state new-m tcp-- dport 22-j accept-an input-p tcp-m state-- state new-m tcp-- dport 80-j accept
Then restart and save the firewall:
Service iptables restart/etc/rc.d/init.d/iptables save
Check again to see if it is on:
/ etc/init.d/iptables status
Start apache:
/ etc/init.d/httpd start
two。 Install mysql:
Yum install mysql mysql-server
Start mysql:
/ etc/init.d/mysqld start
3. Install php
Yum install php php-devel
Restart apache for php to take effect
/ etc/init.d/httpd restart
You can create a php file under the directory: / var/www/html/ at this point
Code:
Then visit this file, you can see some information about php, and the path to the php.ini configuration file can be seen on this page.
Install extensions to php
The copy code is as follows:
Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
You need to restart apache again after installing the extension
/ etc/init.d/httpd restart
Test whether mysql links successful php code
You can pass the above code into the directory / var/www/html/
You can see the implementation.
Installation directory introduction
By default, apache points the root directory of the website to the / var/www/html directory
The default master configuration file is / etc/httpd/conf/httpd.conf
Configure the / etc/httpd/conf.d/ directory where the configuration is stored
At this point, I believe you have a deeper understanding of "how to build a PHP server environment in CentOS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.