I created a website called vishwasthali.org in PHP and hosted it in IIS7 on a third-party server. Everything else works fine except for the database access code I wrote using the MySQLi API. The code works fine on the local host, but not on the server. Using phpinfo() on the server and my machine, I found that:
(1) On my machine (running on Windows 7 32-bit Apache hosting environment) PHP version 5.3.8 and mysqli version 5.0.8-dev and
(2) On the server (running Windows Server 2008, the IIS7 hosting environment), PHP version 5.2.14 and mysqli version 5.0.51a .
Here are the screenshots of phpinfo() on my machine: 

Here are screenshots of phpinfo() on the server: 

Here is an example mysqli code.
session_start(); include_once 'code_files/conn.php'; $stmt = $mysqli->prepare('SELECT * FROM adminusers WHERE Username = ? AND `Password` = ?'); $stmt->bind_param('ss', $_POST['Username'], $_POST['Password']); $stmt->execute(); $result = $stmt->get_result(); if($result->num_rows > 0) ........ else ........
Using echo get_class($mysqli); shows mysqli . This means the code detects mysqli. But the statement $stmt not prepared. Even $mysqli->error; does not display any errors, possibly due to the fact that PHP works in IIS.
Now I have two options: either change the database access code to the classic mysql API, or update the versions of PHP and MySQLi on the server by downloading the latest PHP binaries from php.net . I will not like the first option (which definitely works), hope you know why. The last is not in my hands. I canβt think of anything more than these.
I believe that replacing php_mysqli.dll with updating the mysqli version may be uncertain. But what about the PHP version?
What can I do in this case. Will updating versions of PHP and MySQLi on the server solve my problem? If YES, can this affect other PHP websites running on the server?
Thanks in advance.
kush.impetus
source share