sqlite3和pdo_sqlite不在php apache2 localhost中加载,但在php cmd窗口中加载 [英] sqlite3 and pdo_sqlite not loaded in php apache2 localhost but loaded in php cmd window

查看:184
本文介绍了sqlite3和pdo_sqlite不在php apache2 localhost中加载,但在php cmd窗口中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows 10操作系统.我已经在C:/Apache24PHP7.4.1 in C:/php7中安装了Apache 2.4.在Apache的配置文件httpd.conf中,我添加了以下内容

I use Windows 10 OS. I have installed Apache 2.4 in C:/Apache24 and PHP7.4.1 in C:/php7. In the configuration file of Apache, httpd.conf, I appended the following

    LoadModule php7_module "c:/php7/php7apache2_4.dll"
    #<FilesMatch \.php$>
    #   SetHandler application/x-httpd-php
    #</FilesMatch>
    AddType application/x-httpd-php .php
    PHPIniDir "C:/php7" 

我还通过以下方式修改了php的php.ini文件:

I also have modified the php.ini file of php in the following way:

     extension_dir = C:\php7\ext
     extension=bz2
     extension=curl
     ;extension=ffi
     extension=fileinfo
     extension=gd2
     extension=gettext
     extension=gmp
     extension=intl
     extension=imap
     ;extension=ldap
     extension=mbstring
     extension=exif      ; Must be after mbstring as it depends on it
     extension=mysqli
     ;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
     ;extension=odbc
     extension=openssl
     ;extension=pdo_firebird
     extension=pdo_mysql
     ;extension=pdo_oci
     extension=pdo_odbc
     extension=pdo_pgsql
     extension=pdo_sqlite
     extension=pgsql
     extension=shmop
     ; The MIBS data available in the PHP distribution must be installed.
     ; See http://www.php.net/manual/en/snmp.installation.php
     ;extension=snmp
     extension=soap
     extension=sockets
     ;extension=sodium
     extension=sqlite3
     extension=tidy
     extension=xmlrpc
     extension=xsl

并且仍然在php.ini中,我也进行了修改

and still in php.ini I have also modified

     [sqlite3]
     ; Directory pointing to SQLite3 extensions
     ; http://php.net/sqlite3.extension-dir
     sqlite3.extension_dir = C:\Apache24\htdocs

然后,我重新启动了Apache数十次,并且重新启动了PC.

Then I have restarted apache several tens of times and the PC once.

我制作了一个'index.php'文件,并将其放在'c:/apache24/htdocs'中,该文件中包含以下文本:

I have made a 'index.php' file and placed it in 'c:/apache24/htdocs' which has the following text in it:

    <?php phpinfo(); ?>

在Chrome Web浏览器中转到本地主机",我看到了PHP信息文件.但是,--->它没有启用sqlite3,也没有启用pdo_sqlite< ---.但是,在comand窗口中运行"php -m",它表明已加载sqlite3和pdo_sqlite.此外,在localhost中,PHP信息表示它使用已加载的配置文件,在这里'C:\ php7 \ php.ini'确实是正确的.

Going to 'localhost' in Chrome Web browser I see the PHP info file. However, ---> it does not have sqlite3 nor pdo_sqlite enabled <---. However, running 'php -m' in comand window, it shows that sqlite3 and pdo_sqlite are loaded. Furthermore, in localhost PHP info says that it uses the loaded configuration file found here 'C:\php7\php.ini' hich is indeed the right one.

我没有其他想法,为什么sqlite3或pdo_sqlite在apache2中不可见,而在com窗口中可见,尤其是由于它使用相同的php.ini文件.

I have no other idees, why sqlite3 or pdo_sqlite is not visible in apache2 but visible in com window, especially bue to the fact that it uses the same php.ini file.

Apache24\logs检查'error.log'文件,我看到以下警告:

Checking the 'error.log' file from Apache24\logs I can see that the following warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: C:\\php7\\ext\\pdo_sqlite (The specified module could not be found.), C:\\php7\\ext\\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0 但是,可以使用Windows 10资源管理器在c:\php7\ext中看到php_pdo_sqlite.dll,但是另一方面,C:\\php7\\ext对于Windows资源管理器不是有效的路径.我不知道是否仅将双反斜杠用于打印,或者实际上是否在该路径中进行搜索.但是,cmd不会被双反斜杠打扰.我真的不知道该怎么想!

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: C:\\php7\\ext\\pdo_sqlite (The specified module could not be found.), C:\\php7\\ext\\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0 However, php_pdo_sqlite.dll can be seen in c:\php7\ext using the Windows 10 explorer, but on the other hand C:\\php7\\ext is not a valid path for the windows explorer. I do not know if double backslashes are used just for printing or indeed it searches at that path. However cmd is not bothered by double backslashes. I really do not know what to think!

推荐答案

将Apache升级到2.4.41 +在我的httpd.conf中添加以下内容为我解决了该问题.

Upgrading Apache to 2.4.41 + adding the following to my httpd.conf fixed the problem for me.

# PHP7

LoadModule php7_module "C:/Php/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php .phtml
PHPIniDir C:/Php

# FIX CURL REQUIRES LIBSSH2
LoadFile "C:/Php/libssh2.dll"
LoadFile "C:/Php/libsqlite3.dll"

这篇关于sqlite3和pdo_sqlite不在php apache2 localhost中加载,但在php cmd窗口中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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