简体   繁体   English

已安装 php-mysql 但未在 phpinfo 中显示

[英]php-mysql installed but not showing in phpinfo

I just upgraded my phpversion from php 7.1 to 7.3.我刚刚将我的 phpversion 从 php 7.1 升级到 7.3。 Unfortunately I can't seem to get mysql working.不幸的是,我似乎无法让 mysql 工作。 I'm on a centos 7 box using yum package manager.我在使用 yum package 管理器的 centos 7 机器上。 These are my installed php packages.这些是我安装的 php 包。 I've rebooted and tried uninstalling, reinstalling the mysql extension and it still won't show up in the phpinfo.我已经重新启动并尝试卸载,重新安装 mysql 扩展,但它仍然不会出现在 phpinfo 中。 The only mention of mysql is in the credits section. mysql 的唯一提及是在学分部分。

php73.x86_64                                                                 2.0-1.el7.remi                                                        @remi-safe
php73-common.x86_64                                                          7.3.28-1.el7.ius                                                      @ius
php73-json.x86_64                                                            7.3.28-1.el7.ius                                                      @ius
php73-mbstring.x86_64                                                        7.3.28-1.el7.ius                                                      @ius
php73-pdo.x86_64                                                             7.3.28-1.el7.ius                                                      @ius
php73-pdo-dblib.x86_64                                                       7.3.28-1.el7.ius                                                      @ius
php73-php-cli.x86_64                                                         7.3.28-1.el7.remi                                                     @remi-safe
php73-php-common.x86_64                                                      7.3.28-1.el7.remi                                                     @remi-safe
php73-php-json.x86_64                                                        7.3.28-1.el7.remi                                                     @remi-safe
php73-php-mysqlnd.x86_64                                                     7.3.28-1.el7.remi                                                     @remi-safe
php73-php-pdo.x86_64                                                         7.3.28-1.el7.remi                                                     @remi-safe
php73-php-pear.noarch                                                        1:1.10.12-7.el7.remi                                                  @remi-safe
php73-php-pecl-mcrypt.x86_64                                                 1.0.4-1.el7.remi                                                      @remi-safe
php73-php-pecl-mysql.x86_64                                                  1.0.0-0.20.20180226.647c933.el7.remi                                  @remi-safe
php73-php-pecl-xdebug3.x86_64                                                3.0.4-1.el7.remi                                                      @remi-safe
php73-php-process.x86_64                                                     7.3.28-1.el7.remi                                                     @remi-safe
php73-php-soap.x86_64                                                        7.3.28-1.el7.remi                                                     @remi-safe
php73-php-xml.x86_64                                                         7.3.28-1.el7.remi                                                     @remi-safe
php73-runtime.x86_64                                                         2.0-1.el7.remi                                                        @remi-safe
 php73-php-common.x86_64 7.3.28-1.el7.remi @remi-safe php73-common.x86_64 7.3.28-1.el7.ius @ius

You are mixing 2 PHP stacks from 2 different providers, IUS and Remi.您正在混合来自 2 个不同提供商(IUS 和 Remi)的 2 个 PHP 堆栈。

You should only use one.你应该只使用一个。

For remi repository, I recommend you follow the Wizard instructions对于remi存储库,我建议您按照向导说明进行操作

Notice: I don't see any mod_php or fpm package in your list...注意:我在您的列表中没有看到任何 mod_php 或 fpm package...

Then add extension=yourExtension.so to php.ini,然后将 extension=yourExtension.so 添加到 php.ini,

Never do this, with RPM, each package provides the proper configuration file for its extension(s).千万不要这样做,对于 RPM,每个 package 都为其扩展提供正确的配置文件。 After installation you need to restart the httpd or php-fpm service.安装后需要重启 httpd 或 php-fpm 服务。

If you are using php-fpm, you can use php-fpm -i | grep php.ini如果你使用的是 php-fpm,你可以使用php-fpm -i | grep php.ini php-fpm -i | grep php.ini to find the loaded configuration file. php-fpm -i | grep php.ini找到加载的配置文件。

If using php-cli, php -i | grep php.ini如果使用 php-cli, php -i | grep php.ini php -i | grep php.ini , and so on. php -i | grep php.ini等等。

On some occasions, php-fpm and php-cli aren't using the same php.ini.在某些情况下,php-fpm 和 php-cli 不使用相同的 php.ini。

php -i -> php-cli php -i -> php-cli

php-fpm -i -> php-fpm php-fpm -i -> php-fpm

Then add extension=yourExtension.so to php.ini, and restart your php-fpm, using php-fpm -m | grep yourExtension然后将extension=yourExtension.so添加到 php.ini,并使用php-fpm -m | grep yourExtension重新启动 php-fpm php-fpm -m | grep yourExtension to check if the extension is loaded, it means work if printed you extension name. php-fpm -m | grep yourExtension检查扩展是否加载,如果打印你的扩展名则表示工作。

If there's not, then, you need to find the extension_dir of php: php-fpm -i | grep extension_dir如果没有,则需要找到php的extension_dir: php-fpm -i | grep extension_dir php-fpm -i | grep extension_dir , and check if there is yourExtension.so file, if there's not, it means your extension installed to a wrong place, you need make a soft link or simply cp yourExtension.so to that place. php-fpm -i | grep extension_dir ,并检查是否有 yourExtension.so 文件,如果没有,则表示您的扩展安装到错误的位置,您需要做一个软链接或简单地将 yourExtension.so cp 到那个地方。

If you're using multi-version php, you need check which php you are using.如果您使用的是多版本 php,您需要检查您使用的是哪个 php。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM