Installation/Upgrading Issues
Common installation/upgrading issues and solutions
Loading the Snipe-IT app shows PHP code in the browser
This always means that PHP is either not installed, or is not enabled in your Apache/Nginx/IIS/etc web server.
PHP has two different parts - php-cli
and the module itself, which means it's possible to have PHP work via command line and still not have it enabled as the web server module.
Class "Facade\Ignition\IgnitionServiceProvider" not found
This generally means your composer install
is not up to date. Try going through the upgrade process again.
FatalThrowableError Call to undefined method Laravel\Passport\Passport::personalAccessTokensExpireIn()
Check your .env
file and make sure that each variable and value is separated by an equals sign. In particular, check that:
REDIS_PORT=null
and NOT
REDIS_PORT-null
.
Table Listing Pages load with 401 Unauthorized/Unauthenticated
If you're seeing a 401 error in your browser console when you load the web GUI, it's almost always one of two issues:
Old cached files
Delete the following files if they exist:
bootstrap/cache/compiled.php
bootstrap/cache/services.php
bootstrap/cache/config.php
MIssing PHP Extensions
Although the required extensions haven't changed for quite some time, previous versions would let you get away with not having them installed without failing in such a mysterious way.
Be sure you have all of the extensions listed in the Requirements page.
Later versions of upgrade.php
will try to do a lot of these things for you, so pay attention to your console output if you choose to use that upgrade script.
Updating with upgrade.php fails to update files/version
This is a particularly tricksy one. First, try a git pull
. If you get a giant list of files that have been modified (indicated with an M
in front of the filename) and an error saying that local changes will be lost, even though you know you didn't modify anything locally, try:
git fetch --all
git reset --hard origin/master
WARNING
If you DID make changes to your local install files, performing this action WILL lose your changes. If you're certain you didn't change any of the Snipe-IT application files, you should be fine.
Permission Issues
If you see an error like:
- Blank page with no error
- "Error in exception handler."
- "the stream or file
/var/www/snipeit/storage/logs/laravel.log
could not be opened. failed to open stream: Permission denied"
If you see any of those errors, check the permissions of your storage
directory. Normally when we see the framework fail so hard that it can’t even give you a framework-level error, it’s because of permissions issues.
Your storage
directory and all subdirectories within should be writable by the web server.
If you're running Linux and you're SURE permissions look correct, check to see if you're running SELinux, and make sure you handle your security contexts correctly. (SELinux is a security feature of the Linux kernel, not a particular OS or version of Linux.)
The requested URL /setup was not found on this server
Linux/OSX:
Chances are that mod_rewrite
is either not installed on your system, or has not been configured correctly for your virtualhost using AllowOverride.
Troubleshooting:
Add garbage text into the public/.htaccess
file on your local install and hit the homepage again. If it bombs out (it should), then mod_rewrite is probably working. If it doesn't, it means your webserver isn't even looking for the .htaccess rules and you'll need to check your virtualhost config.
(Make sure to take the garbage out of the .htaccess file once you've gotten it sorted!)
Windows:
The URL Rewrite
module is most likely not installed on your system. Please install it, restart your server, and try again.
Failed to download psy/psysh from source
When running composer install
on slower internet connections, you might run into an error like this:
Failed to download psy/psysh from source: The process "git clone --no-checkout 'https://github.com/bobthecow/psysh.git' '/var/www/html/snipeit/vendor/psy/psysh' && cd '/var/www/html/sni
peit/vendor/psy/psysh' && git remote add composer 'https://github.com/bobthecow/psysh.git' && git fetch composer" exceeded the timeout of 300 seconds. Now trying to download from dist
To resolve this, simply change the composer timeout limit. You can do this each time you run composer install
, by adding COMPOSER_PROCESS_TIMEOUT=3000
to your composer install
command, like this:
COMPOSER_PROCESS_TIMEOUT=3000 composer install --no-dev --prefer-source
Or change the timeout for composer globally (if you have composer installed globally), you can run:
composer --global config process-timeout 3000
Permission error while running composer install
This will usually happen if composer install was run as root (which we state in multiple places throughout the documentation you should never do).
For more information on how Composer works, and how to fix it if you ran it as root, click here.
While running composer: intervention/image dev-master requires ext-fileinfo * -> the requested PHP extension fileinfo is missing or not enabled on your system.
As the error states, your server is missing the fileinfo
extension, which is one of the requirements for running Snipe-IT.
Windows users must include the bundled php_fileinfo.dll
DLL file in php.ini
to enable this extension. To enable Fileinfo, add or uncomment this line in your php.ini:
extension=php_fileinfo.dll
and restart the web server.
Linux users need to add or uncomment the following in their php.ini
:
extension=fileinfo.so
and restart the web server.
Warning: require(/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory
When you see this error, it means that you either forgot to install or run composer, or you did and it failed somewhere and didn't complete, so the dependencies Snipe-IT needs were not installed. See the docs on installing and running composer, and check for any errors composer might return when you attempt to run composer install
.
Once your composer errors are resolved, you can continue with the installation.
PHP version issues
If you see any of these errors, the version of PHP you're using is too old to run Snipe-IT, which requires PHP 7.4 or later.
FatalErrorException. Syntax error, unexpected '[', expecting ')'
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in public/index.php on line 51
PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE)
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
After upgrading PHP, you should also delete the contents of the cached views in storage/framework/views
once you upgrade PHP, to resolve any cached issues.
Base table or view not found: 1146 Table 'oauth_clients' doesn't exist
Run migrations again to create the tables:
php artisan migrate
Mcrypt/OpenSSL Issues
There are a few different errors messages you might encounter that relate to mcrypt.
mcrypt_encrypt(): Size of key is too large for this algorithm
mcrypt_encrypt(): Key size not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported.
openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
If you don't have any encrypted custom fields or if this is a new install, this can be easily solved by simply regenerating your app key using:
php artisan key:generate
If it is an upgrade to v4 or later from an earlier version, you'll need to follow the recrypter instructions in the upgrade guide.
On composer install: "The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths."
If you run into this error before being able to complete the composer install --no-dev
command successfully, you can try the following:
- set
APP_KEY=null
andENCRYPT=false
in your.env
file, THEN - run
composer install --no-dev
THEN - run
php artisan key:generate
THEN - set
ENCRYPT=true
This is not exactly a common error, but we have seen it before (although we've never found a smoking gun). Following the above process should let you complete the composer install process, and will then update your app key to let you proceed.
Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist'
1. Check your .env
file and make sure there are no extra spaces on any of the lines of your config, and that any multi-word config options (or options with special characters) are enclosed in single-quotes.
For example, if you want your MAIL_FROM_NAME
to be "Snipe-IT Asset Management", it should look like this in the .env
file:
MAIL_FROM_NAME='Snipe-IT Asset Management'
2. Check that you don't have any old config files that are no longer used.
- delete the files (not the directory) in
bootstrap/cache
- run
composer dump-autoload
- remove
config/aws.php
if it exists
Class 'Aws\Laravel\AwsServiceProvider' not found
This typically happens when you have a config file left over from an upgrade that was previously deleted.
- delete the files (not the directory) in
bootstrap/cache
- run
composer dump-autoload
- remove
config/aws.php
if it exists
Class 'Barryvdh\DomPDF\ServiceProvider' not found
This usually means you have an extension missing, mostly likely php-sodium
. See this GH issue for more information.
During composer install, it's asking me for my Github credentials
This is an artifact of Github having a very low API rate limit for unauthenticated accounts. Make sure you're using the --prefer-source
flag when doing your composer installs and updates.
PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in \bootstrap\autoload.php on line 43
This happens sometimes with composer, though we don't really know why, as it's not specific to Snipe-IT. If you run into this error after running php composer.phar install --no-dev --prefer-source
, try the following:
- delete your
composer.lock
file - run
php composer.phar dump-autoload
- run
php composer.phar update --no-dev --prefer-source
Call to undefined method Laravel\Passport\Passport::withCookieSerialization()
This is a famously unhelpful error that usually means you're missing a required PHP extension. Check the Requirements page and confirm that all of the required libraries are present. Delete the contents of your vendors
directory, and re-run composer install --no-dev
. (If you see any errors there about missing libraries, you'll be able to quickly see which extensions you're missing. Common ones there are php-ldap and php-bcmath.)
SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large."
If you're unable to run migrations because of this error, use the following settings in your my.cnf
database configuration file:
innodb_log_file_size=512M
innodb_strict_mode=0
If you're upgrading or restoring and run into this error, run:
ALTER TABLE `assets` ROW_FORMAT=DYNAMIC;
ALTER TABLE `users` ROW_FORMAT=DYNAMIC;
SQLSTATE[HY000]: General error: 1005 Can't create table 'snipeit.#sql-3626_1c6' (errno: 150)
This happens when your default table engine is set to MyISAM (which in general is weird. InnoDB has been the default table engine in MySQL for quite some time).
If you see this error:
Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1005 Can't create table 'snipeit.#sql-3626_1c6' (errno: 150) (SQL: alter table users add constraint users_company
_id_foreign foreign key (company_id) references companies (id))
[PDOException]
SQLSTATE[HY000]: General error: 1005 Can't create table 'snipeit.#sql-3626_1c6' (errno: 150)
Try running:
ALTER TABLE companies ENGINE = InnoDB;
on your MySQL database and then re-run migrations.
Error: Insufficient permissions! after upgrading
While older versions of Snipe can be updated rather painlessly by simply using php artisan migrate
, when upgrading from ancient versions (i.e. v1.1) to newer versions you may experience issues with user deletion, viewing backups etc.
This is due to the fact that migrations will not automatically add "Admin" users to the new "Super User" permission group.
To resolve (without raw SQL/db queries) try the following:
- login as an admin user
- create a new (throw away) admin user with Super User permissions
- log out and log back in as new user
- elevate all the users who need Super User
- log out and back into your regular admin account that has just been elevated
- delete the throw away user you created earlier to ensure elevation worked
Duplicate key name 'action_logs_target_id_target_type_index'
If your MySQL defaults to MyISAM as a storage engine (which it shouldn't, since InnoDB has been the default since MySQL 5.6), you will have to run the following on your database before running migrations:
DROP INDEX action_logs_target_id_target_type_index ON action_logs;
DROP INDEX action_logs_created_at_index ON action_logs;
DROP INDEX action_logs_item_type_item_id_action_type_index ON action_logs;
DROP INDEX action_logs_target_type_target_id_action_type_index ON action_logs;
ALTER TABLE action_logs ENGINE = InnoDB;
ALTER TABLE assets ENGINE = InnoDB;
During database migrations: Max key length is 1000 bytes
You would likely only see this is you're upgrading from a much older version of Snipe-IT (v3 or earlier). The default engine for new tables in MySQL was changed to InnoDB (from MyISAM) a long time ago, and newer installs specify InnoDB explicitly, however older tables may have been created as MyISAM if they're very old. (Upgrading Snipe-IT or MySQL itself won't automatically change the engine type.)
If your MySQL defaults to MyISAM as a storage engine (which it shouldn't, since InnoDB has been the default since MySQL 5.6), you will have to run the following on your database before running migrations:
ALTER TABLE action_logs ENGINE = InnoDB
ALTER TABLE assets ENGINE = InnoDB
If you miss this step and run migrations, you can run these commands and then re-run migrations.
Carbon\CarbonInterval::setLocalTranslator() must implement interface Symfony\Component\Translation\TranslatorInterface
If you get an error that looks like this:
Argument 1 passed to Carbon\CarbonInterval::setLocalTranslator() must implement interface Symfony\Component\Translation\TranslatorInterface, instance of Carbon\Translator given, called in /var/www/laravel/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php
this is due to cached vendor files. Manually remove the vendor/symfony/translation/TranslatorInterface.php
file and run composer dump-autoload
.
Updated 4 months ago