单台机器上php HTTP MySQL 组合之脚本测试

单台机器上php HTTP MySQL 组合

[root@wanghua html]# pwd

/var/www/html

[root@wanghua html]# ls

html.php

[root@wanghua html]# cat html.php # DocumentRoot 下以 .php 结尾

<html>

<title> this is php page </title>

<body>

<?php

phpinfo();

?>

</body>

</html>

测试脚本mysql连接PHP
[root@wanghua html]# ls
html.php php-mysql.php
[root@wanghua html]# cat php-mysql.php
<?php
$conn=mysql_connect(‘localhost‘,‘root‘,‘‘);
if ($conn)
echo “ok”;
else
echo “flase”;
?>