Composer Install not working on Centos
Please confirm you have done the following before posting your bug report:
- [ yes] I have enabled debug mode
- [ yes] I have read checked the Common Issues page
Describe the bug A clear and concise description of what the bug is.
I have gotten the issue while installing snipe-it 4.6.4 on a centos server, and while I was running composer to install dependencies.
I first installed composer with this command: "curl -sS https://getcomposer.org/installer | php" but when I run it, it couldn't work. Below are the warning and error I get if I run this command: "php composer.phar install --no-dev --prefer-source"
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. Your requirements could not be resolved to an installable set of packages.
Problem 1 - Installation request for tecnickcom/tc-lib-barcode 1.15.12 -> satisfiable by tecnick com/tc-lib-barcode[1.15.12]. - tecnickcom/tc-lib-barcode 1.15.12 requires ext-bcmath * -> the requested PHP extensi on bcmath is missing from your system.
To Reproduce Steps to reproduce the behavior: NA
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen. N/A
Screenshots
If applicable, add screenshots to help explain your problem.
Server (please complete the following information):
- Snipe-IT Version: 4.6.4
- OS: CentOS
- Web Server: Apache
- PHP Version: 7.1.23
Desktop (please complete the following information): N/A
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information): N/A
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Error Messages N/A
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- If a stacktrace is provided in the error, include that too.
- Any errors that appear in your browser's error console.
- Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
- Include any additional information you can find in
storage/logsand your webserver's logs.
Additional context
-
Is this a fresh install or an upgrade? Answer: A fresh install
-
What OS and web server you're running Snipe-IT on? Answer: Linux Centos, Apache web server
-
What method you used to install Snipe-IT (install.sh, manual installation, docker, etc): manual installation
-
Include what you've done so far in the installation and if you got any error messages along the way. => I downloaded snipe-it 4.6.4 => I copied it on Centos server => I copied the .env.example file .env, and edited that file to enable Debug-mode, and APP_ENV=development => Downloaded and installed composer with the following command: "curl -sS https://getcomposer.org/installer | php". This worked fine => I got the errors while installing dependencies with composer, with this command: php composer.phar install --no-dev --prefer-source
-
Indicate whether or not you've manually edited any data directly in the database. Answer: I didn't
Add any other context about the problem here.
Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.
Hi, Do you have bcmath installed and enabled on your server? On your screanshot there is a message- the requested PHP extension bcmath is missing from your system.
Hi Diniver,
Thanks for your fast response.
It seems like I do not have it [I am new to php]. But when I try to install it with: "yum install bcmath" I get an message: "No package bcmath available", error: nothing to do.
See below screenshot.
Anything I am doing wrong? Thanks
It it php extension so should be something like php71_bcmath (since you are using 7.1.23 version of php)
I am an ubuntu user and Cent os is not my forte but you can have a look here: https://ourcodeworld.com/articles/read/727/how-to-install-the-bcmath-extension-in-centos
Just make sure you are installing bcmath for your php version
Hey, Thanks much, I have now installed the bcmath extension, and no more getting the errors regarding extensions. Though I am still getting the lock file warning. Also, I am getting an error with "vendor" folder which I think is supposed to have all installed dependencies. It seems like it can't be created.
Please see the error:
You can try running composer to ensure that all vendor components are installed. If you wish you can give this a try --> https://github.com/EarlRamirez/snipeit_iso
[SORRY I HAVE WRITTEN A LOT, IT IS THAT I TRIED A LOT OF THINGS, SO WANTED TO GIVE YOU A CONTEXT]
Hey, Still have an issue with installation, I had let you guys so that I don't bother with a lot of questions and have been trying to install almost all day, but guess I messed everything up.
-
At some point, I encountered a permission denied issue in my unprivileged user (on ./composer.json) when I was trying out different stuff, and then when I tried the same thing with root there was no permission denied error.
-
Then I decided to run the "php composer.phar install --no-dev --prefer-source" as root, and it worked somehow (it downloaded many dependencies, but some failed I guess because I had included the security checks by running: "composer require --dev roave/security-advisories:dev-master" ) [ONLY TO FIND OUT THAT IT IS PROHIBITED TO USE root]
-
When I logged in as root, I ran the command to generate the key: php artisan key:generate. The was generated successfully, however when I checked the .env file, APP-KEY variable still has "ChangeMe" value; it was not updated.
-
Also, I tried to generate the key using my unprivileged user, but it didnt work at all, it rather threw this error: (The stream or file "/var/www/html/snipe-it/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied)
-
Then to solve the permission issues, I added my user to apache group, ran " chown -R myuser storage public/uploads" , ran "chhmod -R 755 storage" and "chhmod -R 755 public/uploads"
-
However, I still get following error when trying to generate the key while logged-in as my unprivileged user (file_put_contents(/var/www/html/snipe-it/.env): failed to open stream: Permission denied)
See below screenshot my last error
I think I have done everything I could, Please help me:
- Firstly, how can I solve the issue caused by running the composer dependencies installation AS ROOT [I ran both by root and by the other user]
- Secondly, Seeing my current status (see above issues and last screenshot) please help me on how I can go forward with this installation!
Thanks much
@EarlRamirez thanks for the suggestion, but I had run composer
@Vicky-Akana the custom ISO mentioned was to help streamline the installation process so that anyone that will like to use Snipe-IT can focus on the product and not the installation.
What method did you use to install? Regarding your permission, it will fail because the user does not have access to the web server files, in this case, Apache so can try the following commands.
- chomd -R apache:apache /var/www/html/snipeit
- sudo -u apache php composer.phar install --no-dev --prefer-source
Let us know how it goes
Did you mean chmod, or chown?
- I have run the command (replaced by chown), it worked for changing the owner to my user, and not root.
- I have run this: sudo -u apache php composer.phar install --no-dev --prefer-source, it had nothing else to install or update, since I had installed all dependencies.
- Still the "php artisan key:generate" command was not adding the key to the .env file, it is just generating the key successfully.
Regarding the custom ISO, so we are working on a centos server already, would it be a good thing to install a virtual box with centos on top of it?
@Vicky-Akana, yes! I meant chown sorry about that if the key is generated you can copy it into your .env manually.
For the custom ISO, if your current CentOS installation is on bare metal you can install virtual box and boot the ISO and it will do all the work for you.
If this is not feasible you can always try the hosted option provided by Snipe-IT
@EarlRamirez thanks much. Everything else is working.
Though I got another error but I guess it is MySQL related, and not snipe-it. => I got it while trying to access snipe-it via browser: myserveripaddress/snipe-it/public If possible, plz let me know what is wrong, if it shouldn't be posted on this forum then I understand.
see below screenshot:
Thanks much
There should not be any need to include public in the URL as it should be specified in the virtual host, for the DB error confirm that the credential is correct in the .env file
Hey @EarlRamirez, I really appreciate the help, I have checked the credentials, they are correct. However, I currently have other mysql server issues and I am trying to solve them. When solved (I hope so soon), I will continue with snipe-it testing.
Please wait before closing the ticket.
Thanks
@Vicky-Akana do not worry because I can only close the ticket that I've created, take your time, are the DB errors related to the error previously posted? SQLSTATE[HY000] [2002] Connection Refused? Is the DB server on the same box as snipeit?
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!
This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.