Instal mysqlnd on hosted website

I am developing a website in PHP - MySQL. Here are a few notes:

  • I am using the MySQLi API to access the database.
  • In my local installation of XAMPP (Windows 7 machine) PHP version 5.3.8 , MySQL version mysqlnd 5.0.8-dev - 20102224
  • I hosted the website on a free hosting server for testing "cuccfree.com". Here is PHP version 5.3.14 and MySQL version 5.1.66 . It still supports MySQLi much better than many other hosting companies.
  • In phpinfo'ing of both, the local machine shows the mysqlnd driver, but the hosting server does not.
  • I created a wrapper class for MySQLi that retrieves a ResultSet using the mysqli_stmt :: get_result () function. This function works on my local machine, but not on the cuccfree.com hosting server, because the mysqli object does not have a method named get_result () . Although, the mysqli_stmt object is prepared and bind_param'ed is successful.
  • The mysqli_stmt man page on php.net says that to use mysqli_stmt :: get_result () , we need to install mysqlnd .
  • Server configuration suggests using mysqli_stmt :: bind_object () . But get_result() seems to me a much better choice, since we can get the result as an array. I redefined the function to accept a variable number of arguments using the following line:

    call_user_func_array (array ($ stmt, 'bind_param'), $ params);

where $ params is an array of parameters.

  • Using bind_object (), I have to bind each column returned to a variable. In this case, I cannot create a wrapper class function to process all SQL queries at one point.

I looked for several hosting companies, talked and sent letters to the support service of many companies, including GoDaddy and Manas Hosting, they do not suggest using mysqlnd . They, very logically, insist on using VPS or dedicated servers. And, obviously, both of the proposed options are very expensive, even at the initial level.

So finally, to my question, can we install / deploy mysqlnd into a website on a Linux server? If not, what alternative should I stop me from changing the code for the whole website, which will take me many, many days?

Hello

+4
source share
2 answers

I have experienced this before, and it was a real cannibal. The only solution is to use PDO if you do not want to upgrade to VPS. You can try SSH on a shared hosting account, but good luck is trying to change something, because web administrators are smart in web hosting. Web hosts I even got to the point of removing yum.conf from /etc/ and denying access to it where you could not install any packages through yum. If you get VPS but you have cpanel, you can change the configuration settings for PHP. It took me a long time to figure this out, but I found out that you can change the PHP settings in CPanel by running /usr/local/cpanel/scripts/easyapache . If you run Apache 2.2, you can also change configuration settings for PHP configuration settings by following this documentation. Without VPS, there is no way to change CPanel, as I am sure. Hope this post helps a bit.

+1
source

If your hosting company did not allow the use of dl() , which I can almost guarantee that they did not, then no.

The second option that you have already indicated is to write (or find, they may exist, maybe someone else can point you in that direction) the compatibility level for mysqlnd. I assume that there is no existing one since you wrote your own. So, unfortunately, I believe that you are stuck in the mud.

In any case, you should really use PDO next time :) But I know, retroactively, 20/20, so ...

+1
source

All Articles