PDO for MySQL is not working on Captive Portal on PfSense 2.4.4
-
It seems that PDO for MySQL is not working on Captive Portal on PfSense 2.4.4.
I am using FreeRADIUS with MySQL as authentication database on PfSense 2.4.4. MySQL database is hosted on another server.
This is the error:
Fatal error: Uncaught PDOException: could not find driver in /var/db/cpelements/PHPFILE Stack trace: #0 /var/db/cpelements/PHPFILE PDO->__construct('mysql:host=...) #1 {main} thrown in /var/db/cpelements/PHPFILE
-
I solved my problem by using the following:
To search the php modules type this in the shell console
pkg search php
To install the pdo_mysql module type this in the shell console
pkg install php72-pdo_mysql-7.2.10
The pdo_mysql module is version specific, if you have a higher or you have updated php the module name may have changed depending on the php version you have in pfSense.
The installed pdo_mysql module is from pfSense 2.4.4 which consist of php version 7.2.10.
-
Same for mysqli :)
pkg install php72-mysqli-7.2.10
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.