Solved roundcube-php81 + php81-filter error msg

Hi all,
Because php80 is approaching EOL, I decided to upgrade my roundcube installation by deleting the www/roundecube-php80 flavor and installing www/roundecube-php81. That deleted the php80 dependencies and installed all the php81 things.
Unfortunately, something broke. I now see the following error in /var/log/httpd-error.log:

Code:
[php:error] [pid 22356] [client ##.###.####.###] PHP Fatal error:  Uncaught Error: Call to undefined function filter_var() in /usr/local/www/roundcube/program/lib/Roundcube/bootstrap.php:49\nStack trace:\n#0 /usr/local/www/roundcube/program/include/iniset.php(78): require_once()\n#1 /usr/local/www/roundcube/index.php(40): require_once('/usr/local/www/...')\n#2 {main}\n  thrown in /usr/local/www/roundcube/program/lib/Roundcube/bootstrap.php on line 49

A websearch returns a single hit, on the roundcube forum, posted by someone encountered the same error message a couple of years ago: Call to undefined function filter_var()

There was one reply:
This function is part of php-filter extension which is usually enabled. You're the first person with this disabled/not-installed. I guess, we should mention that in the INSTALL file.

I definitely have this installed:
Code:
pkg info php81-filter
php81-filter-8.1.20
Name           : php81-filter
Version        : 8.1.20
Installed on   : Thu Jul 27 17:12:30 2023 CEST
Origin         : security/php81-filter

Double-checked, it's enabled in httpd.conf
Code:
LoadModule filter_module libexec/apache24/mod_filter.so

Further:
Apache24 v2.4.57_1
FreeBSD v13.2-RELEASE-p1

I thought I would ask here first to see if anyone has any ideas or leads for me. If not I will post on the Roundcube forum. If in due time I learn anything there will definitely share it here too.

TIA
 
I encountered the same problem. Is there any update to this post? Thanks
As you have seen, no leads at all either here or on the roundcube forum. I have been hoping that no one has responded because people are on vacation and that eventually someone will have some ideas, but I am also considering what to do if the problem cannot be solved. Please do let me know if you learn anything more.
 
verify that php filter extension is loaded
echo '<?php echo filter_var("works"); ?>'|php
or create a .php file/webpage containing something like <?phpinfo(); ?> and try to load it with your browser
search for filter ext inside the result
 
Unfortunately, something broke. I now see the following error in /var/log/httpd-error.log:

Code:
[php:error] [pid 22356] [client ##.###.####.###] PHP Fatal error: Uncaught Error: Call to undefined function filter_var() in /usr/local/www/roundcube/program/lib/Roundcube/bootstrap.php:49\nStack trace:\n#0 /usr/local/www/roundcube/program/include/iniset.php(78): require_once()\n#1 /usr/local/www/roundcube/index.php(40): require_once('/usr/local/www/...')\n#2 {main}\n thrown in /usr/local/www/roundcube/program/lib/Roundcube/bootstrap.php on line 49
I had this problem sometime ago. Be sure you don't mix pkgs & ports for your extensions. You should not mix for the other pkgs too - Apache , roundcube, PHP81 etc. Try pkgs if ports have always been used.


Restarting Apache with the hope that it reloads PHP sometimes does not do the magic. A system restart like a Technician of the 80s first advise works better.
 
verify that php filter extension is loaded
echo '<?php echo filter_var("works"); ?>'|php
or create a .php file/webpage containing something like <?phpinfo(); ?> and try to load it with your browser
search for filter ext inside the result
Hi, I used the following command to ensure that apache had indeed loaded the extension:
Code:
$ sudo apachectl -M|grep filter
 filter_module (shared)
Does this suffice?
 
I had this problem sometime ago. Be sure you don't mix pkgs & ports for your extensions. You should not mix for the other pkgs too - Apache , roundcube, PHP81 etc. Try pkgs if ports have always been used.
Thanks, I'm only using ports here, except with postfix. I don't think it is a ports/pkg issue.

Restarting Apache with the hope that it reloads PHP sometimes does not do the magic. A system restart like a Technician of the 80s first advise works better.
I have rebooted the system, alas that doesn't solve the problem.
 
you can't see php extensions via apachectl. they ate not the same as apache modules
OK, so first I try this:
$ echo '<?php echo filter_var("works"); ?>'|php
works


I also create a php file with phpinfo();
Under the section Additional .ini files parsed I see this entry among many:
Code:
/usr/local/etc/php/ext-20-filter.ini

Can I now be sure that this extension is properly loaded or do I need to test anything else?
 
1691952884283.png
 
I suggested trying pkgs in place of ports. And I expect all are built with zts or not.
Roundcube can be troublesome. That is why having an alternative like snappymail is not bad.
 
Please show the output of:
# pkg version -v | grep php

OK, I see some warnings or errors. Rather than experiment with trying to fix this, I will wait the advice from those of you with more understanding of what we're seeing here than I do:


# pkg version -v | grep php
mod_php80-8.0.29 < needs updating (index has 8.0.30)
php81-8.1.20 < needs updating (index has 8.1.22)
php81-bz2-8.1.20 < needs updating (index has 8.1.22)
php81-ctype-8.1.20 < needs updating (index has 8.1.22)
php81-dom-8.1.20 < needs updating (index has 8.1.22)
php81-exif-8.1.20 < needs updating (index has 8.1.22)
php81-fileinfo-8.1.20 < needs updating (index has 8.1.22)
php81-filter-8.1.20 < needs updating (index has 8.1.22)
php81-gd-8.1.20 < needs updating (index has 8.1.22)
php81-gettext-8.1.20 < needs updating (index has 8.1.22)
php81-iconv-8.1.20 < needs updating (index has 8.1.22)
php81-imap-8.1.20 < needs updating (index has 8.1.22)
php81-intl-8.1.20 < needs updating (index has 8.1.22)
php81-mbstring-8.1.20 < needs updating (index has 8.1.22)
php81-mysqli-8.1.20 < needs updating (index has 8.1.22)
php81-pdo-8.1.20 < needs updating (index has 8.1.22)
php81-pdo_mysql-8.1.20 < needs updating (index has 8.1.22)
php81-pdo_sqlite-8.1.20 < needs updating (index has 8.1.22)
php81-session-8.1.20 < needs updating (index has 8.1.22)
php81-xml-8.1.20 < needs updating (index has 8.1.22)
php81-zip-8.1.20 < needs updating (index has 8.1.22)
php81-zlib-8.1.20 < needs updating (index has 8.1.22)
phpMyAdmin-php81-4.9.11_1 = up-to-date with index
postfixadmin33-php81-3.3.13 = up-to-date with index
roundcube-php81-1.6.1,1 < needs updating (index has 1.6.2,1)
zenphoto-php81-1.6 = up-to-date with index


Thanks in advance
 
OK, I see some warnings or errors. Rather than experiment with trying to fix this, I will wait the advice from those of you with more understanding of what we're seeing here than I do:

Code:
# pkg version -v | grep php
mod_php80-8.0.29                   <   needs updating (index has 8.0.30)
php81-8.1.20                       <   needs updating (index has 8.1.22)
php81-bz2-8.1.20                   <   needs updating (index has 8.1.22)
php81-ctype-8.1.20                 <   needs updating (index has 8.1.22)
php81-dom-8.1.20                   <   needs updating (index has 8.1.22)
php81-exif-8.1.20                  <   needs updating (index has 8.1.22)
php81-fileinfo-8.1.20              <   needs updating (index has 8.1.22)
php81-filter-8.1.20                <   needs updating (index has 8.1.22)
php81-gd-8.1.20                    <   needs updating (index has 8.1.22)
php81-gettext-8.1.20               <   needs updating (index has 8.1.22)
php81-iconv-8.1.20                 <   needs updating (index has 8.1.22)
php81-imap-8.1.20                  <   needs updating (index has 8.1.22)
php81-intl-8.1.20                  <   needs updating (index has 8.1.22)
php81-mbstring-8.1.20              <   needs updating (index has 8.1.22)
php81-mysqli-8.1.20                <   needs updating (index has 8.1.22)
php81-pdo-8.1.20                   <   needs updating (index has 8.1.22)
php81-pdo_mysql-8.1.20             <   needs updating (index has 8.1.22)
php81-pdo_sqlite-8.1.20            <   needs updating (index has 8.1.22)
php81-session-8.1.20               <   needs updating (index has 8.1.22)
php81-xml-8.1.20                   <   needs updating (index has 8.1.22)
php81-zip-8.1.20                   <   needs updating (index has 8.1.22)
php81-zlib-8.1.20                  <   needs updating (index has 8.1.22)
phpMyAdmin-php81-4.9.11_1          =   up-to-date with index
postfixadmin33-php81-3.3.13        =   up-to-date with index
roundcube-php81-1.6.1,1            <   needs updating (index has 1.6.2,1)
zenphoto-php81-1.6                 =   up-to-date with index

Thanks in advance
You are running Apache using mod_php, don’t you?
Either update mod_php80 to mod_php81 or switch to the fastcgi implementation.

In both cases, this is the start:
# pkg delete mod_php80

PS:

In my experience, Roundcube is unstable with mod_php. Quite frequently it crashed Apache altogether - I use the SQLite3 backend. After I switched to fastcgi, I experienced no crashes anymore.
 
That's one of the problems thay come with ports! Hence, you were asked to try pkgs. It would have automagically fixed it, when displaying PKG requirements. And you might have noticed the problem there. Keep that grep query in mind; you will always need it and much more. Good to see it now resolved.
 
Back
Top