self-service-password icon indicating copy to clipboard operation
self-service-password copied to clipboard

Can I support PHP8.0 or above as soon as possible? I really need it.

Open liugang926 opened this issue 4 years ago • 12 comments

My test project currently does not support PHP8.0 or higher.Can I support PHP8.0 or above as soon as possible? I really need it.

liugang926 avatar Jun 11 '21 02:06 liugang926

At first glance, I don't see any error loading SelfServicePassword pages when installed on a PHP-8 base, ldap functions are there, ... could you elaborate: have you seen an error? In which context? What are you trying to do?

faust64 avatar Jun 11 '21 06:06 faust64

I don’t know the situation, I checked the error log,display:Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in /var/www/service_password/lib/vendor/PHPMailer/PHPMailerAutoload.php on line 45

liugang926 avatar Jun 11 '21 07:06 liugang926

Are you still using 1.3? lib/vendor/PHPMailer was replaced by lib/vendor/phpmailer/phpmailer/, in 1.4.

faust64 avatar Jun 11 '21 08:06 faust64

I see that the installation package of version 1.4 seems to be incomplete, whether it is the official website or github, it seems that there is a lack of key files like index.php.

liugang926 avatar Jun 11 '21 08:06 liugang926

php files were moved to some htdocs/ subdir

$ dpkg -L self-service-password|grep index.php
/usr/share/self-service-password/htdocs/index.php
/usr/share/self-service-password/lib/vendor/gregwar/captcha/demo/index.php
$ dpkg -l|grep self-service-password          
ii  self-service-password             1.4.3-1                                all          LDAP password change web interface

There may be some paths to change, if you used to run 1.3

faust64 avatar Jun 11 '21 08:06 faust64

This seems to affect the file routing relationship, how should I adjust the file path? Can the file be adjusted and available for download? Because in this case, many people really cannot achieve service startup.

liugang926 avatar Jun 11 '21 08:06 liugang926

I tried to copy all the files in the htdocs directory to the root directory of the project, and an error was reported, prompting:Warning: require_once(../conf/config.inc.php): Failed to open stream: No such file or directory in /var/www/service_password/index.php on line 11

Fatal error: Uncaught Error: Failed opening required '../conf/config.inc.php' (include_path='.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/service_password/index.php:11 Stack trace: #0 {main} thrown in /var/www/service_password/index.php on line 11

liugang926 avatar Jun 11 '21 08:06 liugang926

Yes, moving php files out of htdocs won't work, as they won't know where to load their libraries or configuration from.

If you're using Apache, the DocumentRoot should be changed from /usr/share/self-service-password to /usr/share/self-service-password/htdocs With Nginx, same goes for the root of the server block used serving Self-Service-Password.

There's no virtualhost configuration shipping with Self-Service-Password: there is a pair samples documented, though it would vary depending on your setup (tls configuration omitted, ...) https://self-service-password.readthedocs.io/en/v1.4/config_webserver.html - there's a typo in the nginx, the root points to /var/www/html, should be /usr/share/self-service-password/htdocs, I've just sent a PR, ...

faust64 avatar Jun 11 '21 09:06 faust64

I am using nginx, try to configure root as /usr/share/self-service-password/htdocs, but it seems to be unsuccessful and an error is reported: Warning: Undefined variable $use_captcha in /var/www/service_password/htdocs/index.php on line 19

Warning: Undefined variable $questions_use_default in /var/www/service_password/htdocs/index.php on line 55

Warning: Undefined variable $ldap_use_exop_passwd in /var/www/service_password/htdocs/index.php on line 76

Warning: Undefined variable $ldap_use_ppolicy_control in /var/www/service_password/htdocs/index.php on line 78

Warning: Undefined variable $mail_smtp_options in /var/www/service_password/htdocs/index.php on line 119

Warning: Undefined variable $pwd_diff_last_min_chars in /var/www/service_password/htdocs/index.php on line 144

Warning: Undefined variable $pwd_no_special_at_ends in /var/www/service_password/htdocs/index.php on line 148

Warning: Undefined variable $pwd_forbidden_words in /var/www/service_password/htdocs/index.php on line 149

Warning: Undefined variable $pwd_forbidden_ldap_fields in /var/www/service_password/htdocs/index.php on line 150

Warning: Undefined variable $max_attempts_per_user in /var/www/service_password/htdocs/index.php on line 157

Warning: Undefined variable $max_attempts_per_ip in /var/www/service_password/htdocs/index.php on line 158

Warning: Undefined variable $max_attempts_block_seconds in /var/www/service_password/htdocs/index.php on line 159

Warning: Undefined variable $presetLogin in /var/www/service_password/htdocs/change.php on line 29

Warning: Undefined variable $use_captcha in /var/www/service_password/htdocs/change.php on line 40

Fatal error: Uncaught Error: Undefined constant "SMARTY" in /var/www/service_password/htdocs/index.php:187 Stack trace: #0 {main} thrown in /var/www/service_password/htdocs/index.php on line 187

liugang926 avatar Jun 11 '21 09:06 liugang926

Sounds like the config.inc.php doesn't set v1.4 defaults: are you still using a copy from 1.3?

/self-service-password$ git diff v1.3..master conf/config.inc.php
...
+$ldap_use_exop_passwd = false;
+$ldap_use_ppolicy_control = false;
...
+# Should the built-in questions be included?
+$questions_use_default = true;
...
+## Captcha
+$use_captcha = false;
...
+if (!defined("SMARTY")) {
+    define("SMARTY", "/usr/share/php/smarty3/Smarty.class.php");
+}
...

You should define your site variables in config.inc.local.php, and keep the default config.inc.php from whichever self-service-password version you are running, otherwise upgrade would have side-effects like these. See https://self-service-password.readthedocs.io/en/v1.4/config_general.html#configuration-files

faust64 avatar Jun 11 '21 09:06 faust64

Hi,Excuse me, I still encounter a key problem, the error message: Warning: require_once(/usr/share/php/smarty3/Smarty.class.php): Failed to open stream: No such file or directory in /var/www/service_password/htdocs/index.php on line 184

Fatal error: Uncaught Error: Failed opening required '/usr/share/php/smarty3/Smarty.class.php' (include_path='.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/service_password/htdocs/index.php:184 Stack trace: #0 {main} thrown in /var/www/service_password/htdocs/index.php on line 184

I can't find the location of this file Smarty.class.php

liugang926 avatar Jun 16 '21 07:06 liugang926

Sure, Smarty is a a library. If you installed Self-Service-Password using RPM or DEB packages, Smarty should be installed as a dependency (php-Smarty on el8, smarty3 on deb). The Docker image would do something like this:

RUN mkdir -p /usr/share/php/smarty3/ && \
    curl -Lqs https://github.com/smarty-php/smarty/archive/v3.1.35.tar.gz | \
    tar xzf - -C /usr/share/php/smarty3/ --strip-components=2

If you're not using docker, nor the debian/rpm packages: you would need to install Smarty yourself.

faust64 avatar Jun 16 '21 07:06 faust64

Looks like this issue is solved and can be closed. Am I right @liugang926? If so, would you be so kind and close it?

stevleibelt avatar Feb 14 '23 07:02 stevleibelt

You're right... let me.

faust64 avatar Feb 17 '23 23:02 faust64

Looks like this issue is solved and can be closed. Am I right @liugang926? If so, would you be so kind and close it? I'm very sorry, my Issue has not been solved yet. I can't solve the dependency installation of Smarty for the time being.

liugang926 avatar Feb 20 '23 02:02 liugang926

I can't solve the dependency installation of Smarty for the time being.

You did not answer my last follow-up though. How did you install self-service-password?

self-service-password packages should pull smarty as a dependency. Without packages: you should still be able to install smarty using your distro package manager (php-Smarty on el8, smarty3 on deb). Or: pulling some smarty release from their github repository.

You were mentioning the following error:

Fatal error: Uncaught Error: Failed opening required '/usr/share/php/smarty3/Smarty.class.php'

Let me run the commands I suggested you to run in response:

# mkdir -p /usr/share/php/smarty3
# curl -Lqs https://github.com/smarty-php/smarty/archive/v3.1.35.tar.gz | tar xzf - -C /usr/share/php/smarty3/ --strip-components=2
# ls -l /usr/share/php/smarty3/Smarty.class.php 
-rw-r--r-- 1 root root 38506 Apr 14  2020 /usr/share/php/smarty3/Smarty.class.php

Now, if you still have an issue, please let us know what's going on.

faust64 avatar Feb 22 '23 23:02 faust64

Hello,

I'm trying to install self service password on el9 with rpm package self-service-password-1.5.2-1.el9.noarch.rpm but got a smarty dependancy error:

  • nothing provides php-Smarty needed by self-service-password-1.5.2-1.el9.noarch

I download latest smarty 4.3 as zip, unzip into /usr/share/php/smarty3 (tried to rename as smarty4 to) and copy everything from libs folder to parent folder as mentioned on smarty website.

Still getting the error message when i try to install self service rpm. Any idea ?

Thanks

Gokusan31 avatar Mar 13 '23 14:03 Gokusan31

Could you enable debug and send logs?

coudot avatar Mar 13 '23 14:03 coudot

What do you mean by enable log ? I set debuglevel to 10 in my yum.conf and go this:


Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
DNF version: 4.10.0
Command: dnf install /root/self-service-password-1.5.2-1.el9.noarch.rpm 
Installroot: /
Releasever: 9
cachedir: /var/cache/dnf
Base command: install
Extra commands: ['install', '/root/self-service-password-1.5.2-1.el9.noarch.rpm']
User-Agent: constructed: 'libdnf (AlmaLinux 9.0; generic; Linux.x86_64)'
elrepo-9-x64                                                                                                                                 423 kB/s | 2.0 kB     00:00    
reviving: 'Elrepo_elrepo-9-x64' can be revived - repomd matches.
Elrepo_elrepo-9-x64: using metadata from Tue 14 Feb 2023 05:00:35 AM CET.
rpmfusion-el9-x64                                                                                                                            550 kB/s | 2.3 kB     00:00    
reviving: 'RPMFusion_rpmfusion-el9-x64' can be revived - repomd matches.
RPMFusion_rpmfusion-el9-x64: using metadata from Fri 10 Feb 2023 02:48:33 PM CET.
epel-9-x64                                                                                                                                   407 kB/s | 2.3 kB     00:00    
reviving: 'EPEL_epel-9-x64' can be revived - repomd matches.
EPEL_epel-9-x64: using metadata from Thu 16 Feb 2023 03:50:37 PM CET.
almalinux-stream-9-x64                                                                                                                       580 kB/s | 2.6 kB     00:00    
reviving: 'AlmaLinux_almalinux-stream-9-x64' can be revived - repomd matches.
AlmaLinux_almalinux-stream-9-x64: using metadata from Thu 16 Feb 2023 05:04:51 AM CET.
almalinux-extras-9-x64                                                                                                                       563 kB/s | 2.3 kB     00:00    
reviving: 'AlmaLinux_almalinux-extras-9-x64' can be revived - repomd matches.
AlmaLinux_almalinux-extras-9-x64: using metadata from Fri 10 Feb 2023 02:40:52 PM CET.
almalinux-base-9-x64                                                                                                                         447 kB/s | 2.3 kB     00:00    
reviving: 'AlmaLinux_almalinux-base-9-x64' can be revived - repomd matches.
AlmaLinux_almalinux-base-9-x64: using metadata from Wed 15 Feb 2023 05:05:32 AM CET.
timer: sack setup: 502 ms
--> Starting dependency resolution
--> Finished dependency resolution
timer: depsolve: 215 ms

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 130, in cli_run
    ret = resolving(cli, base)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 166, in resolving
    base.resolve(cli.demands.allow_erasing)
  File "/usr/lib/python3.9/site-packages/dnf/base.py", line 878, in resolve
    raise exc
dnf.exceptions.DepsolveError: 
 Problem: conflicting requests
  - nothing provides php-Smarty needed by self-service-password-1.5.2-1.el9.noarch
Error: 
 Problem: conflicting requests
  - nothing provides php-Smarty needed by self-service-password-1.5.2-1.el9.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
Cleaning up.

Gokusan31 avatar Mar 13 '23 15:03 Gokusan31

Ok, you commented an issue on PHP 8.0 and your problem is that php-Smarty package is not available on EL9, you should open a new issue for this.

coudot avatar Mar 13 '23 15:03 coudot