如何在cPanel管理的服务器上安装MySQLi? [英] How to install MySQLi on a cPanel-managed server?

查看:72
本文介绍了如何在cPanel管理的服务器上安装MySQLi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个过去几年编写的现有Web应用程序.我选择mysqli作为访问MySQL数据库的方法.很好我的问题是我正在部署到第三方Web主机服务器-WHM/cPanel-我找不到在该服务器上安装mysqli的方法.我已经尝试了太多要在此处列出的内容-包括我在此网站上可以找到的所有内容. 该服务器使用yum.它具有PHP5.4-MySQL 5.5当我在其上运行phpinfo时,有一个MySQL部分,但没有MySQLi部分.我的代码因找不到mysqli类"错误而崩溃. PHP.net上的文档指出,从PHP 5.0开始,mysqli已包含在标准发行版中.我知道事实已经不对了-我用Ubuntu构建的最后3台机器上没有mysqli,我不得不使用apt-get install php5-mysqlnd查找/安装它,而我却找不到mysqli的软件包该服务器. 重写所有SQL以使用本机驱动程序将不是一件容易的事.我宁愿避免这种情况.任何想法将不胜感激.

I have an existing web application that was written over the past few years. I chose mysqli as the method for accessing a MySQL database. That works fine. My problem is that I'm deploying to a 3rd party web host server - WHM/cPanel - and I cannot find a way to get mysqli installed on this server. I've tried too many things to list here - including everything I could find on this site. This server uses yum. It has PHP5.4 - MySQL 5.5 When I run phpinfo on it there is a MySQL section but no MySQLi section. My code crashes with "class mysqli not found" error. The documentation on PHP.net states that mysqli was included in the standard distribution starting with PHP 5.0. I know for a fact that is no longer true - the last 3 machines i've built with Ubuntu did not have mysqli on them I had to find/install it using apt-get install php5-mysqlnd I cannot find a package for mysqli on this server. Rewriting all my SQL to use the native driver will not be a simple task. i'd prefer to avoid that. Any ideas would be greatly appreciated.

推荐答案

我自己的问题的答案:WHM->软件-> EasyApache

The answer to my own question: WHM --> Software --> EasyApache

我的当前配置显示在顶部,并且已选中(单选按钮).我对此进行了编辑,然后选择了穷举选项列表".我能够选择多个项目,包括mysqli,mbstring,json,mcrypt,XML,日期,openssl,套接字,soap,xmlwriter ... ...令人难以置信的是,其中许多缺失了很多是我还没有发现的下一个问题.

My current configuration was shown at the top and was selected (radio button). I edited that and selected Exhaustive List of Options. I was able to select several items including mysqli, mbstring, json, mcrypt, XML, date, openssl, sockets, soap, xmlwriter ... hard to believe so many of those were missing many were my next problem I just had not yet discovered.

EasyApache为我重新编译了apache/php并自动重启了apache.现在已将MySQLi以及我选择的其他元素包括在内.

EasyApache recompiled apache/php for me and restarted apache automagically. MySQLi was now included along with the other elements I selected.

要进一步配置PHP,我必须使用phpinfo查找正在加载的php.ini文件,并以root(sudo)对其进行编辑.

To further configure PHP - I had to use phpinfo to find the php.ini file it is loading and edit that as root (sudo). There is a facility located in

WHM->服务配置-> PHP配置编辑器

WHM --> Service Configuration --> PHP Configuration Editor

代替,但使用此页面不太可能所有选项都可用.另外:请参阅下面的注释:我必须手动编辑php.ini才能配置新内容.

that can be used instead but it is unlikely all options will be available using this page. Also: see note below: I had to manually edit php.ini to configure the new stuff.

我还要指出,应该将其他部分添加到php.ini文件中,但没有添加.应该有一个部分可以配置mysqli(与mysql [native driver]分离),mbstring,soap等.在运行EasyApache更新PHP后,这些文件不存在于服务器上的php.ini文件中.我必须编辑php.ini文件并为它们添加相应部分,然后重新启动apache.仅供参考

I'd like to also point out that there are additional sections that should have been added to the php.ini file but were not. There should be a section to configure mysqli (separate from mysql [native driver]), mbstring, soap etc. These are not present in the php.ini file on my server after running EasyApache to update PHP. I had to edit the php.ini file and add the sections for them and restart apache. Just FYI

这篇关于如何在cPanel管理的服务器上安装MySQLi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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