debian 安装方法:
apt-get install apache2 mysql-server-5.0 php5-common php5-mysql libapache2-mob-php5
apt-get install apache2 mysql-server-5.0 php5
apt-get clean
apt-get install libmysql++-dev
/etc/init.d/apache2 start
php代码如下:
$link = mysql_connect("ip", "username", "password");
if(FALSE == $link)
{
echo "Connect database failed!";
}
echo "Connect database sucess!";
mysql_select_db('dbname', $link);
运行提示:Fatal error: Call to undefined function: mysql_connect()
原因:mysql不支持php,解决办法:
apt-get install php5-mysql
/etc/init.d/apache2 restart
阅读(1661) | 评论(0) | 转发(0) |