Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php 8.1 #632

Closed
zolyyy opened this issue Jun 27, 2022 · 23 comments
Closed

Php 8.1 #632

zolyyy opened this issue Jun 27, 2022 · 23 comments
Assignees
Labels

Comments

@zolyyy
Copy link

zolyyy commented Jun 27, 2022

Hi,
I use php 8.1
Too many problems, can't log in... and everything is wrong...

@DavidGoodwin
Copy link
Member

Hello - thanks for the bug report.

What version of Postfixadmin are you trying to use?

@zolyyy
Copy link
Author

zolyyy commented Jun 27, 2022

Latest 3.3.11

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137

Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137
Invalid token (session timeout; refresh the page and try again?)

@DavidGoodwin
Copy link
Member

Those Deprecated messages are really an aritfact of your PHP configuration.

You should probably change your php.ini file, and change the 'error_reporting' level to exclude deprecations.

@DavidGoodwin
Copy link
Member

the above commit might help though?

@zolyyy
Copy link
Author

zolyyy commented Jun 28, 2022

the above commit might help though?

The error messages have stopped, but I still can't log in. Setup.php finds everything as good.
After try login:
Invalid token (session timeout; refresh the page and try again?)

image

@DavidGoodwin
Copy link
Member

invalid token - could be caused by ...

  • some problem with cookies to/from your server (e.g. brower is blocking them) or
  • there's something wrong with your server and it's not able to save session files on disk
  • or you have multiple windows/tabs accessing postfixadmin at once (as each new page load would overwrite the session hash value that another depends on).

See also #630

@zolyyy
Copy link
Author

zolyyy commented Jun 28, 2022

invalid token - could be caused by ...

  • some problem with cookies to/from your server (e.g. brower is blocking them) or
  • there's something wrong with your server and it's not able to save session files on disk
  • or you have multiple windows/tabs accessing postfixadmin at once (as each new page load would overwrite the session hash value that another depends on).

See also #630

Cookies, session works. The error message does not disappear. What I noticed in login.php is that the SESSION['PFA_token'] is not created. I am using PHP memcached.

@DavidGoodwin
Copy link
Member

It's possible the error warnings from the PHP8.1 deprecations are being output early in the request, before PHP has started the session / sent cookies.

I'd suggest you change your php error_reporting level to silence them for now, or tell PHP to log to a file rather than stdout (see https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log )

@zolyyy
Copy link
Author

zolyyy commented Jun 28, 2022

There are currently no error messages, but cannot login

@ramanzes
Copy link

ramanzes commented Jul 5, 2022

first bug:

ERROR: the templates_c directory doesn't exist or isn't writeable for the webserver

RESOLVED
mv ./templates ./templates_c


second bug:

Deprecated: htmlentities(): Passing null to parameter https://github.com/postfixadmin/postfixadmin/issues/1 ($string) of type string is deprecated in /srv/postfixadmin/model/PFASmarty.php on line 137

RESOLVED
vim /srv/postfixadmin/model/PFASmarty.php
if (is_object($data) || is_null($data)) {

but after fix, bug number Three :

Fatal error: Uncaught --> Smarty: Unable to load template 'file:index.tpl' <-- thrown in /var/www/postfixadmin/lib/smarty/libs/sysplugins/smarty_internal_template.php on line 195

What now? please help

p.s.
1)PHP 8.1
2)version postfix:
https://github.com/postfixadmin/postfixadmin/archive/refs/tags/postfixadmin-3.3.10.tar.gz

@DavidGoodwin
Copy link
Member

you shouldn't have renamed 'templates' to 'templates_c' - they're very different

  • templates -> contains a load of .tpl files (html like, with smarty syntax for embedding stuff etc
  • templates_c -> smarty 'compiles' it's template file (e.g. index.tpl) into templates_c/somethingsomethingsomething_index.tpl.php for performance reasons.

I'd suggest you :

  • mv templates_c templates
  • mkdir templates_c && chmod 1777 templates_c

and then try again?

@ramanzes
Copy link

ramanzes commented Jul 5, 2022

yes, thanks! this solved the problem

@DavidGoodwin
Copy link
Member

There are currently no error messages, but cannot login

Sorry, @ramanzes's message distracted me. Is it still not working?

@PowerKiKi
Copy link
Contributor

Is PHP 8.1 officially supported ? Is anybody successfully running postfixadmin on PHP 8.1 ?

@DavidGoodwin
Copy link
Member

@PowerKiKi PHP8.1 should work with the code in 'master'.

If it doesn't then I'd consider that a bug and something that should be fixed.

I suspect I'd attempt to back port any fixes to the last stable branch too. Personally I've been a bit lazy and not really used PHP8+ yet (mostly because I'm not yet in $dayjob).

@andypost
Copy link

andypost commented Jul 28, 2022

Please release a Release Candidate to simplify building

@Nenoni13
Copy link

Nenoni13 commented Nov 30, 2022

Hello
I've update from php7.4-fpm to php8.1-fpm and I have this Two error :
I'm using memcached too.

AH01071: Got error 'PHP message: PHP Warning: session_start(): Cannot find session save handler "memcache" - session startup failed in /www/html/postfixadmin/common.php on line 25PHP message: PHP Warning: session_destroy(): Trying to destroy uninitialized session in /www/html/postfixadmin/public/login.php on line 90PHP message: PHP Warning: session_start(): Cannot find session save handler "memcache" - session startup failed in /www/html/postfixadmin/public/login.php on line 91PHP message: PHP Warning: Undefined array key "theme_favicon" in /www/html/postfixadmin/templates_c/f28feb935365aa7a3f51e6613c4353d63cac3ffc_0.file.header.tpl.php on line 36'
AH01071: Got error 'PHP message: PHP Warning: session_start(): Cannot find session save handler "memcache" - session startup failed in /www/html/postfixadmin/common.php on line 25', referer: https://postfixadmin.nenonipark.tk/login.php

Seens I can't login anymore

Is there any update for postfixadmin for compatibility php8.1 ?

I've rollback to 7.4-fpm to fix the issue

Thx :)

@DavidGoodwin
Copy link
Member

@Nenoni13 I don't think postfixadmin is trying to configure/use a memcache session handler - if you create a "test.php" with :

<?php
session_start();
$_SESSION['test'] = $_SESSION['test'] ?? date('c');
var_dump($_SESSION['test']);

and point a browser at it and click refresh a few times, i think you'll see a similar moan/warn about your session handler.

@Nenoni13
Copy link

Ok I've juste found my mistake.

I've made a mistake in configuration of memcached.ini :

session.save_handler="memcached"
session.save_path= "127.0.0.1:11211"

There is a good one
~

@DavidGoodwin
Copy link
Member

Thanks for confirming

@supersophie
Copy link

supersophie commented Jun 29, 2023

HI,

I upgraded from php 7 to php 8.2 and have the same errors.
The installation worked fine until the upgrade to php 8.2
Postfix Version 3.3.13 on Debian 12 and nginx.

My templates_c is writeable.
It is mounted via tmpfs re.g tmpfs /var/www/mx.exmaple.org/templates_c tmpfs nodev,nosuid,noexec,nodiratime,size=4M,uid=33,gid=33,mode=1777 0 0
And www-data can write to this.

The error is:
2023/06/12 18:51:11 [error] 3799#3799: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/mx989.example.int/functions.inc.php on line 697" while reading response header from upstream, client: 12.24.32.82, server: mx989.example.int, request: "GET /login.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "mx989.example.int"

for ($i = 0; $i < $j; ++$i) {
switch ($string{$i}) {
case '=':
case '<':
case '>':
case ',':
case '?':
case '_':
if ($iEncStart === false) {
$iEncStart = $i;

And the client gets a 403.

The nginx config did not change.

@supersophie
Copy link

supersophie commented Jun 29, 2023

HI,

I upgraded from php 7 to php 8.2 and have the same errors. The installation worked fine until the upgrade to php 8.2 Postfix Version 3.3.13 on Debian 12 and nginx.

My templates_c is writeable. It is mounted via tmpfs re.g tmpfs /var/www/mx.exmaple.org/templates_c tmpfs nodev,nosuid,noexec,nodiratime,size=4M,uid=33,gid=33,mode=1777 0 0 And www-data can write to this.

The error is: 2023/06/12 18:51:11 [error] 3799#3799: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/mx989.example.int/functions.inc.php on line 697" while reading response header from upstream, client: 12.24.32.82, server: mx989.example.int, request: "GET /login.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "mx989.example.int"

for ($i = 0; $i < $j; ++$i) { switch ($string{$i}) { case '=': case '<': case '>': case ',': case '?': case '_': if ($iEncStart === false) { $iEncStart = $i;

The nginx config did not change.

OK, Stupid = off.

I just realised my migration was rubbish and I had incorrectly set the permissions on a dir. I am very embarrassed.

@DavidGoodwin
Copy link
Member

Thanks for confirming @supersophie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants