Laravel 5.5 install on Ubuntu 16.04 error - php

When I am trying to intall Laravel to Ubuntu with the following command:
composer global require "laravel/installer"
I get the following error (see following image)
When I run:
php --ini
I get the following output (see following image)
I really cannot see what the problem is, all help i appreciated.
Thanks

I will give you one small tip, whenever any error occurs, kindly try reading through it.
As it says requires ext-zip that means it is require extension ZIP installed to perform required operation.
So all you need to do as of now is to install ZIP extension for php using this command
sudo apt-get install php7.0-zip

Related

Switch php versions on start composer update

I have PHP v7.4 on Ubuntu server. And I have an alternative PHP in the path /opt/php81/bin/
I need to start command composer update with PHP 8.1
I tried like that /opt/php81/bin/php composer update but I see the error
Could not open input file: composer
I tried that /opt/php81/bin/php composer update --working-dir=/var/www/user/data/www/myweb.site
and I see the same error.
I found that this solution works !
/opt/php81/bin/php /usr/local/bin/composer update --working-dir=/var/www/user/data/www/myweb.site

Laravel composer install giving error "Your lock file does not contain a compatible set of packages please run composer update"

I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install

Laravel Snappy PDF Exit Status Code 127

I am trying to print a HTML to PDF file for hardcopy and file purposes of my project in Laravel. I tried to use the barryvdh/laravel-snappy so I followed the documentations carefully and I also installed this wkhtmltopdf for ubuntu 16.04 64x bit cause I think it is required in order to use this package. But there is a big problem. When I generate a PDF sample using Snappy it gives me this error.
Is there something wrong in the installation of my wkhtmltopdf? or is it a directory issue? I tried to sudo chmod -R 777 usr/bin/wkhtmltopdf but still got the same error.
I also followed this this link to help me out. But ended up in the same error.
Looking for help.
Thanks in advance.
Btw I am using Ubuntu 17.10 64-bit
wkhtmltodf version - 0.12.3.2
I would suggest you to use the below package for integrating PDF feature.
I personally use this and its working great and easy to use.
https://github.com/barryvdh/laravel-dompdf
If you came across any issue using this plugin please ask me i will help you out for sure.
E.g
Make sure to install and configure this package as mention in the document also make sure to run the below command after installation and configuration of this package.
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
then try using the below code:
$date = Carbon::now()->format('j F, Y');
data = ['date'=>$date];
$pdf = PDF::loadView('admin.pages.application', $data)->setPaper('a4');
return $pdf->download('download.pdf');
on my Ubuntu 20.04 i had to install a few more dependencies for it to work
Edit this file /etc/apt/sources.list and add this line to the end of it: deb http://security.ubuntu.com/ubuntu bionic-security main
After that run: sudo apt update && apt-cache policy libssl1.0-dev
Finally: sudo apt-get install libssl1.0-dev
And finish with: sudo apt-get install libxrender1
Please give 777 permission to vendor folder and then check it

Getting error during use of composer installation on windows

I have executed the following command on windows command prompt
folder path >php composer.phar install
Getting Error
Could not open input file: composer.phar
Your command is trying to use composer which is not installed. It is not used to install composer. You have to install it using one of methods stated here:
https://getcomposer.org/doc/00-intro.md
The other option is that your path to composer file is wrong, which can also be fixed by following documentation.

Why cant I run bin/behat?

I am trying to run behat on my vendor folder. I have installed composer globally, have installed the behat package, but every time I run bin/behat I keep getting this message from composer
You must set up the project dependencies, run the following commands:
curl -s http://getcomposer.org/installer | php
php composer.phar install
I am not sure how to fix this. I see the files are in the vendor folder, and when I type "composer" on the terminal, I see the manual.
If anyone can help me resolve this I would really appreciate it. Thanks!
There are several possible problems leading to this situation:
Make sure that composer is installed in your $PATH. That is, running composer at a command prompt should work, and you shouldn't need to run an explicit path like ~/Downloads/composer.phar
Execute the composer install instruction as the error message suggests. A common error is the message
Mcrypt PHP extension required
in which case you need to install the specified extension. For example, brew install php56-mcrypt on a Mac or sudo apt-get install php5-mcrypt on Ubuntu.

Categories