1

Why is PHP 8.1.1 not loading PDO driver using Apache 2.4.52 even the modules are loaded on PHP CLI?

I am running a window 11 64bit system I tried Apache/2.4.52 (Win64) (Apache 2.4 VS16) and Apache 2.4.x OpenSSL 1.1.1 VC15 from https://www.apachehaus.com/cgi-bin/download.plx#MODULES24VS16.

I installed Microsoft Visual C++ 2019 Redistributable (VS16) from above site too. I installed PHP 8-1.1 VS16 x64 Thread Safe (2021-Dec-15 11:08:34) from https://windows.php.net/download#php-8.1.

I enabled the extensions (uncommented).

extension=pdo_pgsql
extension=pdo_sqlit
extension=pgsql

extension_dir = "c:\php-8.1.1\ext"

Now the issues:

In version Apache 2.4 VS16 Apache is not starting httpd.exe -t Cannot load c:\php-8.1.1\php8apache2_4.dll into server: %1 is not a valid Win32 application.

configuration on httpd.conf:

PHPINIDir "c:/php-8.1.1/php.ini"
LoadModule php_module "c:\php-8.1.1\php8apache2_4.dll"

in Apache VC15 the server starts but the PDO driver is not loading in phpinfo() PDO drivers no value curl is not loaded pgsql is not loaded

php cli is working.

c:\Apache24\bin>php -m
[PHP Modules]
...
curl
PDO
pdo_pgsql
pgsql
....
[Zend Modules]
Mehrwarz
  • 413
  • 1
  • 10

2 Answers2

0

I fixed my problem by adding the PHP ext folder path in extension_dir on php.ini I changed "" to "/" and it worked.

extension_dir = "c:/php-8.1.1/ext"
Mehrwarz
  • 413
  • 1
  • 10
-2

I was having the same problem, on the same operating system. Solved it when I changed Apache 2.4.52 VC16 to VC15. PHP loaded the extensions normally

ad08
  • 2,522
  • 1
  • 14
  • 18