snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.11k stars 3.18k forks source link

Can't run 'php upgrade.php #12265

Open donvenco opened 1 year ago

donvenco commented 1 year ago

Debug mode

Describe the bug

When I try to run "sudo upgrade.php" command to upgrade my snipe-it I get this message: "This script should not be run as root/admin. Exiting."

I then tried to run the command as the owner of the files in /var/www/snipeit "sudo -u snipeitapp upgrade.php" The error I get this time is "upgrade.php: command not found"

Trying to upgrade to version v6.0.14 because I get 500 error when users try to sign in to the app with LDAP credentials. /var/www/snipeit/storage/logs/laravel.log shows many errors Access Denied for user forge@localhost

access denied

Reproduction steps

1.I try to run "sudo upgrade.php" command

  1. Then I try "sudo -u snipeitapp upgrade.php"
  2. It says upgrade.php: command not found
  3. The upgrade.php file exists in the /var/www/snipeit and snipeit is the owner of the file ...

Expected behavior

I expected the command to work

Screenshots

access denied

Snipe-IT Version

v6.0.13 build 8923 (g30f4af3ac)

Operating System

Ubuntu

Web Server

Apache

PHP Version

7.4.33

Operating System

Windows

Browser

Chrome

Version

108.0.5359.125

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

donvenco commented 1 year ago

I figured out the issue with the command not working. I was typing "sudo -u snipeitapp upgrade.php" instead of "sudo -u snipeitapp php upgrade.php"

However, now that I have updated successfully to v6.0.14 build 9038 (g163b3f6c0) and gone to enable LDAP I see the following msg in the GUI:

LDAP error

Which is the initial issue I am having and that is where when LDAP users sign in and see the 500 error.

samotelf commented 1 year ago

I'm not an expert but it seems that php is lacking the ldap module. Do you have output when doing php -m | grep ldap? If not you have to install it.

snipe commented 1 year ago

@samotelf is correct. The error message is telling you that you don't have the PHP-LDAP installed/enabled.

donvenco commented 1 year ago

I believe I do. This is not a new installation it has been working for the past two years. I guess it doesn't hurt to try installing/enabling it. What would be the appropriate command to install/enable PHP-LDAP

donvenco commented 1 year ago

I tried installing it using the command "apt-get install php-ldap" and restarted the server afterward but the issue still persists. I am wondering if it is the PHP version. Where would I specify for Snipe-IT to use 8.1 version of PHP instead of 7.4.33?

samotelf commented 1 year ago

The php version doesn’t matter since snipe already supports 8. Do a php -m to see the php modules installed and check for the ldap module. Maybe you can try sudo apt-get install -y php-ldap also php —version will tell you the version you’re running