Installation:
yum install -y httpd php
< p>Check version:
rpm -qa httpd php
httpd-2.2.15-54.el6.centos.x86_64
php-5.3.3 -48.el6_8.x86_64
Modify the apache configuration file:
vim /etc/httpd/conf/httpd.conf
Add a line under the #ServerName www.example.com:80 line
ServerName localhost:80
Change the Listen 80 inside to Listen “Your IP”:80
You can use /80 to quickly locate.
Test apache:
service httpd restart
curl- i 192.168.240.129
There is no error message and a lot of codes are prompted to indicate that apache is installed successfully. As shown in the picture
Test PHP:
service httpd restart
cd /var/www/html
vim index.php enter and save the following code:
phpinfo();
?>
curl -i 192.168.240.129/index. php
There is no error message and a lot of codes indicate that the php installation was successful: as shown in the figure
mysql to be tested
After testing, it is found that apache and PHP are automatically configured after yum is installed, which is very good. It is more comfortable than code compilation, ha ha.