首先先下载apache,mysql,php三个组件

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

mysql扩展

yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

php扩展

yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel

apache的默认网页路径在/var/www/html 创建一个php文件,index.php

<html>
	<body>
		Apache works, you are genius!
	</body>
</html>

<?php
	$conn = mysql_connect('localhost','root','123456');
	if($conn)
		echo "MySQL Success.";
	else
		echo "MySQL Failed";
	
	phpinfo();
?>