复制以下代码粘贴至conn_mysql.php文件,把“你的密码”改成你的mysql密码
<?php
$connection = mysql_connect ("localhost","root","你的密码");
mysql_select_db ("mysql");
if($connection){
echo "<script>alert('数据库连接正常');</script>";
}
else{
echo "<script>alert('数据库连接失败,请检mysqle服务是否启动');</script>";
}
?>在浏览器里输入:http://127.0.0.1/conn_mysql.php后失败
显示:Not FoundThe requested URL /conn_mysql.php was not found on this server.
这是怎么回事,本人是菜鸟,求大侠们知道。

解决方案 »

  1.   

    not found 是你这个php页面没找到,和程序连接数据库没关系,你首先要弄清除
    检查网站根目录下是否有 conn_mysql.php文件
      

  2.   

    访问的路径不对。看看conn_mysql.php放在什么地方了
      

  3.   

    检查你的php环境和, 先检查你的WEB服务器环境吧  如果是Apache的话 检查配置是否正常,  监测方法:尝试输出  <? phpinfo();?>
      

  4.   

    http://wenku.baidu.com/view/53a8503383c4bb4cf7ecd102.html
    按照这个一步一步配置就可以了。
      

  5.   

    Apache配置是否正常,放在根目录还是不行呀。什么情况?
      

  6.   


    搞不好 php都还没支持...哈哈
      

  7.   

    [Sun Apr 29 13:44:07 2012] [notice] Parent: child process exited with status 255 -- Restarting.
    [Sun Apr 29 13:44:07 2012] [notice] Apache/2.2.22 (Win32) PHP/5.2.17 configured -- resuming normal operations
    [Sun Apr 29 13:44:07 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun Apr 29 13:44:07 2012] [notice] Parent: Created child process 7676
    [Sun Apr 29 13:44:07 2012] [notice] Child 7676: Child process is running
    [Sun Apr 29 13:44:07 2012] [notice] Child 7676: Acquired the start mutex.
    [Sun Apr 29 13:44:07 2012] [notice] Child 7676: Starting 64 worker threads.
    [Sun Apr 29 13:44:07 2012] [notice] Child 7676: Starting thread to listen on port 80.
    [Sun Apr 29 13:44:12 2012] [notice] Parent: child process exited with status 255 -- Restarting.
    [Sun Apr 29 13:44:12 2012] [notice] Apache/2.2.22 (Win32) PHP/5.2.17 configured -- resuming normal operations
    [Sun Apr 29 13:44:12 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun Apr 29 13:44:12 2012] [notice] Parent: Created child process 5868
    [Sun Apr 29 13:44:12 2012] [notice] Child 5868: Child process is running
    [Sun Apr 29 13:44:12 2012] [notice] Child 5868: Acquired the start mutex.
    [Sun Apr 29 13:44:12 2012] [notice] Child 5868: Starting 64 worker threads.
    [Sun Apr 29 13:44:12 2012] [notice] Child 5868: Starting thread to listen on port 80.
    [Sun Apr 29 13:44:22 2012] [notice] Parent: child process exited with status 255 -- Restarting.
    [Sun Apr 29 13:44:23 2012] [notice] Apache/2.2.22 (Win32) PHP/5.2.17 configured -- resuming normal operations
    [Sun Apr 29 13:44:23 2012] [notice] Server built: Jan 28 2012 11:16:39
    [Sun Apr 29 13:44:23 2012] [notice] Parent: Created child process 7028
    [Sun Apr 29 13:44:23 2012] [notice] Child 7028: Child process is running
    [Sun Apr 29 13:44:23 2012] [notice] Child 7028: Acquired the start mutex.
    [Sun Apr 29 13:44:23 2012] [notice] Child 7028: Starting 64 worker threads.
    [Sun Apr 29 13:44:23 2012] [notice] Child 7028: Starting thread to listen on port 80.
    这是error.log内容,在浏览器里输入:http://127.0.0.1/conn_mysql.php后网页还是打不开
      

  8.   

    根目录新建个文件<?php
    phpinfo();
    ?>然后看看是否正常
      

  9.   

    <?php
    phpinfo();
    ?>
    正常