To enable php mysqli class support
-
How can i enable mysqli extension to overcome this error in captiveportal?
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/etc/captiveportal_zone1.html:2 Stack trace: #0 /etc/inc/pfsense-utils.inc(2674): include() #1 /etc/inc/captiveportal.inc(2271): get_include_contents('/var/etc/captiv...') #2 /usr/local/captiveportal/index.php(295): portal_reply_page('', 'login', NULL, '98:fa:9b:92:36:...', '10.100.22.82') #3 {main} thrown in /var/etc/captiveportal_zone1.html on line 2 PHP ERROR: Type: 1, File: /var/etc/captiveportal_zone1.html, Line: 2, Message: Uncaught Error: Call to undefined function mysql_connect() in /var/etc/captiveportal_zone1.html:2 Stack trace: #0 /etc/inc/pfsense-utils.inc(2674): include() #1 /etc/inc/captiveportal.inc(2271): get_include_contents('/var/etc/captiv...') #2 /usr/local/captiveportal/index.php(295): portal_reply_page('', 'login', NULL, '98:fa:9b:92:36:...', '10.100.22.82') #3 {main} thrown
-
Short : by installing the PHP mysqli extension.
You can check the PHP settings used by visiting https://your-pfsense.your-place.tld/phpinfo.php
There are two solution :
Get the right package from the pfSense repositry (this is not a pfSEnse GUI package, ths is command line work using "pkd add ....", or,
Just read here :Install the FreeRadius pfSense GUI package, which will in turn install the needed MySQLi PHP extension (I guess - I have it - didn't check).
I never installed this PHP extension manually, but I have the extension, as FreeRadius includes it (because it needs it).
You don't have to actually use "FreeRadius". -
@gertjan said in To enable php mysqli class support:
https://your-pfsense.your-place.tld/phpinfo.php
The extension Mysqli shows that its already installed , but when i try a simple DB connection to a mysql server i get rhe error.
i.emysql_connect('xx.xx.xx.xx', 'user', 'pass','database')
The Error
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/etc/captiveportal_zone1.html:2 Stack trace: #0 /etc/inc/pfsense-utils.inc(2674): include() #1 /etc/inc/captiveportal.inc(2271): get_include_contents('/var/etc/captiv...') #2 /usr/local/captiveportal/index.php(295): portal_reply_page('', 'login', NULL, '98:fa:9b:92:36:...', '10.100.22.82') #3 {main} thrown in /var/etc/captiveportal_zone1.html on line 2 PHP ERROR: Type: 1, File: /var/etc/captiveportal_zone1.html, Line: 2, Message: Uncaught Error: Call to undefined function mysql_connect() in /var/etc/captiveportal_zone1.html:2 Stack trace: #0 /etc/inc/pfsense-utils.inc(2674): include() #1 /etc/inc/captiveportal.inc(2271): get_include_contents('/var/etc/captiv...') #2 /usr/local/captiveportal/index.php(295): portal_reply_page('', 'login', NULL, '98:fa:9b:92:36:...', '10.100.22.82') #3 {main} thrown
-
Thanks alot i finally succeeded. It requires the updated driver
mysqli
instead ofmysql
that i was using earlier. -
Correct. "mysqli" requires "mysqli" support, which is different from the older "mysql" (-connect) library.