OPNsense Forum

English Forums => General Discussion => Topic started by: josepgb on January 21, 2016, 05:16:42 pm

Title: [SOLVED] PHP with mysql support missing
Post by: josepgb on January 21, 2016, 05:16:42 pm
Hi,

I installed opnsense, and I have a captive portal page wich needs php56-mysql activated.

I launched it and I get this error

Fatal error: Call to undefined function mysql_connect() in /var/etc/captiveportal_cpzone.html on line 23

I see the php56-mysql package is acivated, but somehow it does not have any effect on the captive portal page.

Any help on how to activate it?

Tks
Title: Re: PHP with mysql support missing
Post by: AdSchellevis on January 21, 2016, 11:09:22 pm
Hi Tks,

You're probably using a custom template which includes "captiveportal_cpzone.html" somewhere, the mysql_connect doesn't appear to be in our codebase.

The upcoming new version (16.1) will implement a completely redesigned captive portal, please pay attention before doing an upgrade because the old method of including code into the template won't function any more.
(an easier, more secure template option is available)

Regards,

Ad
Title: Re: PHP with mysql support missing
Post by: franco on January 22, 2016, 07:11:51 am
Hi there,

The extension can be activated by modifying /usr/local/etc/rc.php_ini_setup changing:

-PHPMODULES="dom xml simplexml"
+PHPMODULES="dom xml simplexml mysql"

I saw your post over at pfSense, it's true that mysql will be removed with PHP 7.0 so please do consider migrating to mysqli instead. I will make both packages available for 16.1. They will need to be installed from the command line, because they have been removed from the standard package:

#pkg install php56-mysql
#pkg install php56-mysqli

If you need tighter support consider writing a plugin, which can automatically install dependencies and other required files:

https://github.com/opnsense/plugins

There will also be an improvement for autoloading extensions today, so that with 16.1 you won't have to edit the above file anymore. :)

http://stackoverflow.com/questions/17986647/upgrade-php-mysql-code-to-use-mysqli-instead


Hope that helps,
Franco
Title: Re: [SOLVED] PHP with mysql support missing
Post by: franco on January 22, 2016, 09:39:40 am
The extended extension support has been added and will be available in 16.1:

https://github.com/opnsense/core/commit/29dc0b5e4d049eeeb9cb8aeff3e91b3217427193