安装apache:
yum install httpd httpd-devel
启动apache:
/etc/init.d/httpd start
此时输入服务器的IP地址,应该看到apache的服务页面,端口不用输,apache默认就是使用80端口
安装MysqL:
启动MysqL:
/etc/init.d/MysqLd start
安装PHP
重启apache使PHP生效
/etc/init.d/httpd restart
代码:
安装PHP的扩展
安装完扩展之后需要再次重启apache
/etc/init.d/httpd restart
<?PHP
$con = MysqL_connect("10.0.@.@@","@@","@@");
if (!$con)
{
die('Could not connect: ' . MysqL_error());
}
MysqL_select_db("mydb",$con);
$result = MysqL_query("SELECT * FROM sys_user");
while($row = MysqL_fetch_array($result))
echo $row['UserName'] . " " . $row['PassWord'] . " " . $row['id'];
echo "<br />";
MysqL_close($con);
?>
可以把上面的代码传入目录
/var/www/html/
就可以看到执行情况