Jump to content

Unable to connect to MySql after changing PHP version


ethereal1m

Recommended Posts

Dear all,

after I downgraded my php from 5.3 to 5.2, php scirpts cannot connect to MySql server. I'm not sure what part of the configurations that I need to modify.

 

Other than that, I can run a php scripts on my Apache sever, I can go to MySql database and do queries.

 

I use Apache 2.2.14, PHP 5.2.12, and MySql 5.1.41-community.

 

I double checked my PHP.ini and httpd.conf files and found nothing wrong. Or am I wrong?

 

Did I miss anything? I think I need to understand this problem before I reinstall mysql, which will suck....

 

The following is myphpinfo that could help introduce the problem:


PHP Version 5.2.12

System     Windows NT SERENITY 5.1 build 2600
Build Date     Dec 16 2009 17:01:16
Configure Command     cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--without-pi3web"
Server API     Apache 2.0 Handler
Virtual Directory Support     enabled
Configuration File (php.ini) Path     C:\WINDOWS
Loaded Configuration File     C:\WINDOWS\php.ini
Scan this dir for additional .ini files     (none)
additional .ini files parsed     (none)
PHP API     20041225
PHP Extension     20060613
Zend Extension     220060519
Debug Build     no
Thread Safety     enabled
Zend Memory Manager     enabled
IPv6 Support     enabled
Registered PHP Streams     php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports     tcp, udp
Registered Stream Filters     convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*


MySQL
MySQL Support    enabled
Active Persistent Links     0
Active Links     0
Client API version     5.1.41
Directive    Local Value    Master Value
mysql.allow_persistent    On    On
mysql.connect_timeout    60    60
mysql.default_host    no value    no value
mysql.default_password    no value    no value
mysql.default_port    no value    no value
mysql.default_socket    no value    no value
mysql.default_user    no value    no value
mysql.max_links    Unlimited    Unlimited
mysql.max_persistent    Unlimited    Unlimited
mysql.trace_mode    Off    Off

Apache Environment

Variable    Value
HTTP_HOST     serenity
HTTP_USER_AGENT     Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)
HTTP_ACCEPT     text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE     en-us,en;q=0.5
HTTP_ACCEPT_ENCODING     gzip,deflate
HTTP_ACCEPT_CHARSET     ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_KEEP_ALIVE     300
HTTP_CONNECTION     keep-alive
HTTP_COOKIE     PHPSESSID=1gq0b4r8bg2p0qdrf1clmja504
HTTP_CACHE_CONTROL     max-age=0
PATH     C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;c:\program files\common files\autodesk shared\;c:\program files\jzip;C:\oraclexe\app\oracle\product\10.2.0\server\OCI\lib\MSVC;C:\instantclient_10_2;C:\oraclexe\app\oracle\product\10.2.0\server\OCI\include;C:\oraclexe\app\oracle\product\10.2.0\server\OCI\lib\MSVC\vc71;;C:\Program Files\GNU\GnuPG;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files\Apache Software Foundation\Apache2.2\bin;C:\PHP;C:\Program Files\TSE\Regular Expression Component Library Vc9\Dll;C:\Program Files\CMake 2.8\bin;C:\Program Files\pcre-8.00\lib\Debug;C:\PHP\ext\;C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PHP_Debug-1.0.3
SystemRoot     C:\WINDOWS
COMSPEC     C:\WINDOWS\system32\cmd.exe
PATHEXT     .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PHP
WINDIR     C:\WINDOWS
SERVER_SIGNATURE     no value
SERVER_SOFTWARE     Apache/2.2.14 (Win32) PHP/5.2.12
SERVER_NAME     serenity
SERVER_ADDR     192.168.1.2
SERVER_PORT     80
REMOTE_ADDR     192.168.1.2
DOCUMENT_ROOT     C:/Program Files/Apache Software Foundation/Apache2.2/
SERVER_ADMIN     sXXXXXXXX@gmail.com
SCRIPT_FILENAME     C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpinfo.php
REMOTE_PORT     1236
GATEWAY_INTERFACE     CGI/1.1
SERVER_PROTOCOL     HTTP/1.1
REQUEST_METHOD     GET
QUERY_STRING     no value
REQUEST_URI     /info
SCRIPT_NAME     /info

 

Best regards,

Ethereal1m

Link to comment
Share on other sites

According to your phpinfo() output, the mysql extension is enabled and the problem is likely something in the code. Why did you downgrade from php5.3 at all (it might be relevant to the problem)?

 

What symptoms or errors do you get that tell you that you cannot connect? What is your main code and the code that is making the connection (show us the opening php tags in the file(s) as well.) xxxxxx out any sensitive information but don't change any of the syntax being used.

Link to comment
Share on other sites

Hi,

thanks for the fast reply. The reason I downgraded was because I'm using xdebug to debug the php script and the latest version of xdebug doesn't work well with PHP5.3.

 

The code that i'm having is a very simple connection test:

<?php
$con = mysql_connect("localhost","root","xxxxxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("test", $con);

$result = mysql_query("SELECT * FROM name");

while($row = mysql_fetch_array($result))
  {
  echo $row['id'] . " " . $row['name'];
  echo "<br />";
  }

mysql_close($con);
?>

 

I can do this manually from MySql prompt. I got error from the browser (I'm using firefox). It pops up a message saying:

httpd.exe - Application Error

The instrunction at "xxxxxxx" reference memory at "xxxxx". The memory could not be "read"

Click on OK to terminate the program
Click on CANCEL to debug the program

 

Looks like Apache is complaining......

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.