使用MySql执行PHP脚本时,httpd.exe崩溃 [英] httpd.exe Crashes when executing a PHP Script with MySql in it

查看:97
本文介绍了使用MySql执行PHP脚本时,httpd.exe崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PHP的新手,在过去的几天里我一直在学习一些php,现在我正在尝试执行其中包含MySql代码的脚本,但不幸的是,浏览器出现了有关httpd的错误. exe文件!

I'm new to PHP and i've been learning some php for the past couple of days, now i'm trying to execute a script with MySql code in it but unfortunately the browser comes up with an error about httpd.exe!

这只是建立mysql连接的简单代码:

it's just a simple code making a mysql connection:

<?php

$conn = mysql_connect("localhost", "root", "");
echo "$conn";
mysql_close($conn);

?>

之前,我在php mysql_connect中存在未定义函数的问题,该问题已得到修复.我有Apache 2.2.16&在Windows XP上运行的PHP 5.2.6.

before i had the problem of an undefined function in php mysql_connect which has been fixed. I have Apache 2.2.16 & PHP 5.2.6, running on windows xp.

推荐答案

我的猜测是它可能在echo "$conn"上崩溃了,因为您正试图强制PHP将MySQL资源转换为字符串.如果要检查连接对象,请使用 var_dump print_r .

My guess is that it's probably crashing on echo "$conn", because you're trying to force PHP to cast a MySQL resource to a string. If you want to inspect the connection object, use var_dump or print_r.

这篇关于使用MySql执行PHP脚本时,httpd.exe崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆