ethereal1m Posted January 20, 2010 Share Posted January 20, 2010 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 [email protected] 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 Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 20, 2010 Share Posted January 20, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-998711 Share on other sites More sharing options...
ethereal1m Posted January 20, 2010 Author Share Posted January 20, 2010 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...... Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-998730 Share on other sites More sharing options...
ethereal1m Posted January 20, 2010 Author Share Posted January 20, 2010 I just found out that when the php script is executed using php.exe, it doesn't have any problem. Hence the problem lies between Apache and MySQL..... hmmm I'm confused more... Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-998821 Share on other sites More sharing options...
ethereal1m Posted January 20, 2010 Author Share Posted January 20, 2010 And also when I change the PHP version back to 5.3, the problem's gone.... what's going on here? Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-998862 Share on other sites More sharing options...
PFMaBiSmAd Posted January 22, 2010 Share Posted January 22, 2010 The symptoms you are getting are indicative of using a mix of different versions of the php .dll files and/or you are not stopping and starting your web server to get it to use the files that have just been replaced. Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-999828 Share on other sites More sharing options...
ethereal1m Posted January 23, 2010 Author Share Posted January 23, 2010 hmm...that makes sense...how can I fix this? I how can change the version back and forth without messing out with the dll files? Which part of the Apache configuration that look for particular dll files? best regards, ethereal1m Quote Link to comment https://forums.phpfreaks.com/topic/189168-unable-to-connect-to-mysql-after-changing-php-version/#findComment-1000438 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.