如何在 cPanel 管理的服务器上安装 MySQLi?

How to install MySQLi on a cPanel-managed server?(如何在 cPanel 管理的服务器上安装 MySQLi?)
本文介绍了如何在 cPanel 管理的服务器上安装 MySQLi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个现有的 Web 应用程序,该应用程序是在过去几年中编写的.我选择 mysqli 作为访问 MySQL 数据库的方法.这很好用.我的问题是我正在部署到 3rd 方网络主机服务器 - 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、date、openssl、sockets、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 [本机驱动程序] 分开)、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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)