laravel instal error with composer - laravel

I'm trying to instal laravel the following fairly sure I have mcrypt installed
me:~/public_html$ composer create-project laravel/laravel laravel-test
Installing laravel/laravel (v5.0.22)
- Installing laravel/laravel (v5.0.22)
Loading from cache
Created project in laravel-test
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16].
- laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

sudo apt-get install php5-mcrypt
Create an auxiliary symlink and enable the module:
cd /etc/php5/mods-available
ln -sf ../conf.d/mcrypt.ini .
php5enmod mcrypt
Finally, reload apache2 configuration:
service apache2 reload
Try this first and then run your above code as laravel needs mcrypt php extension installed.

This solved my problem
sudo rm /etc/php5/mods-available/mcrypt.ini
sudo apt-get purge php5-mcrypt
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
link here - Error Installing Laravel: Mcrypt PHP extension required

Related

Trying to install laravel/ui composer is failing

I am trying to install the laravel/ui for Laravel 6.4, but when I try to install through composer I get the error message Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravel/framework (locked at v6.4.0, required as ^5.0) is satisfiable by laravel/framework[v6.4.0], but these conflict with your requirements or minimum-stability.
Problem 2
- laravel/framework v5.0.9 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
...
...
...
To enable extensions, verify that they are enabled in your .ini files:
...
Installation failed, reverting ./composer.json to its original content.
I have tried to install it manually as well, but to no avail. composer.json : composer.json
If mcrypt or ext-mcrypt is not enabled open your php.ini and search for
;extension=php_mcrypt.so
then remove the ; from the beginning of that line. Same procedure for the other extension.
source to find and open the file path; Laravel requires the Mcrypt PHP extension

laravel Installation failed, deleting ./composer.json

hi In Laravel Installation
The following error occurred
user#user-System-Product-Name:/$ composer global require "laravel/installer"
Changed current directory to /home/user/.config/composer
Using version ^2.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.1/cli/php.ini
- /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.1/cli/conf.d/10-opcache.ini
- /etc/php/7.1/cli/conf.d/10-pdo.ini
- /etc/php/7.1/cli/conf.d/20-calendar.ini
- /etc/php/7.1/cli/conf.d/20-ctype.ini
- /etc/php/7.1/cli/conf.d/20-exif.ini
- /etc/php/7.1/cli/conf.d/20-fileinfo.ini
- /etc/php/7.1/cli/conf.d/20-ftp.ini
- /etc/php/7.1/cli/conf.d/20-gettext.ini
- /etc/php/7.1/cli/conf.d/20-iconv.ini
- /etc/php/7.1/cli/conf.d/20-json.ini
- /etc/php/7.1/cli/conf.d/20-mcrypt.ini
- /etc/php/7.1/cli/conf.d/20-mysqli.ini
- /etc/php/7.1/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.1/cli/conf.d/20-phar.ini
- /etc/php/7.1/cli/conf.d/20-posix.ini
- /etc/php/7.1/cli/conf.d/20-readline.ini
- /etc/php/7.1/cli/conf.d/20-shmop.ini
- /etc/php/7.1/cli/conf.d/20-sockets.ini
- /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.1/cli/conf.d/20-sysvsem.ini
- /etc/php/7.1/cli/conf.d/20-sysvshm.ini
- /etc/php/7.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
Installation failed, deleting ./composer.json.
I'm using the latest composer version...
php7 , mysql , apache2 already installed
Just need zip extension:
# For php v7.2
sudo apt-get install php7.2-zip
it says the requested PHP extension zip is missing from your system.
you have to enable or install that.
# For php v7.0
sudo apt-get install php7.0-zip
# For php v7.1
sudo apt-get install php7.1-zip
I worked by previously installing Composer, after php.
Run:
sudo apt-get install php7.2-zip
sudo apt-get install php7.2-curl
The only thing that helped me was updating my PHP to 7.4 with Brew.
brew install php#7.4
Nothing else worked for me.
if you use php 7.3
sudo apt-get install php7.3-curl
or simply if you are not sure with the version, just use code below
sudo apt-get install php7.2-curl
The only thing that helped me was install php-xml
sudo apt-get install php-xml

PHP7 : install ext-dom issue

I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error:
pish#let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloquent-sluggable
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^4.2 for cviebrock/eloquent-sluggable
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpunit/php-code-coverage (installed at 4.0.7) -> satisfiable by phpunit/php-code-coverage[4.0.7].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gd.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I have no problem installing this package on local version of the app .
First of all, read the warning! It says do not run composer as root!
Secondly, you're probably using Xammp on your local which has the required php libraries as default.
But in your server you're missing ext-dom. php-xml has all the related packages you need. So, you can simply install it by running:
sudo apt-get update
sudo apt install php-xml
Most likely you are missing mbstring too. If you get the error, install this package as well with:
sudo apt-get install php-mbstring
Then run:
composer update
composer require cviebrock/eloquent-sluggable
sudo apt install php-xml will work but the thing is it will download the plugin for the latest PHP version.
If your PHP version is not the latest, then you can add version in it:
# PHP 7.1
sudo apt install php7.1-xml
# PHP 7.2:
sudo apt install php7.2-xml
# PHP 7.3
sudo apt install php7.3-xml
# PHP 7.4
sudo apt install php7.4-xml
# PHP 8
sudo apt install php-xml
For CentOS, RHEL, Fedora:
$ yum search php-xml
============================================================================================================ N/S matched: php-xml ============================================================================================================
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php-xmlseclibs.noarch : PHP library for XML Security
php54-php-xml.x86_64 : A module for PHP applications which use XML
php54-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php55-php-xml.x86_64 : A module for PHP applications which use XML
php55-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php56-php-xml.x86_64 : A module for PHP applications which use XML
php56-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php70-php-xml.x86_64 : A module for PHP applications which use XML
php70-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php71-php-xml.x86_64 : A module for PHP applications which use XML
php71-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php72-php-xml.x86_64 : A module for PHP applications which use XML
php72-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php73-php-xml.x86_64 : A module for PHP applications which use XML
php73-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
Then select the php-xml version matching your php version:
# php -v
PHP 7.2.11 (cli) (built: Oct 10 2018 10:00:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# sudo yum install -y php72-php-xml.x86_64
you need just update your local composer file:
first you need remove "composer.lock" file from you app
then, exec in your bash:
composer update --ignore-platform-req=ext-curl
so try again
composer require cviebrock/eloquent-sluggable

How do I install mcrypt extension for php 7.1 on MacOS 12 for Laravel development?

This is driving me crazy and following all the online tutorials hasn't helped.
I have just upgraded to a new mac running MacOS Sierra (10.12.1) and am trying to get my development environment configured. However, whenever I run composer update or composer install on my project I get the following message:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so, 9): image not found in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework v5.0.35 -> satisfiable by laravel/framework[v5.0.35].
- laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
Problem 2
- laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- tom-lingham/searchy 2.0.10 requires illuminate/support 5.* -> satisfiable by laravel/framework[v5.0.35].
- Installation request for tom-lingham/searchy 2.0.10 -> satisfiable by tom-lingham/searchy[2.0.10].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php.ini
I have run brew install mcrypt and it is already installed.
Warning: mcrypt-2.6.8 already installed
The system is running php 7.1 so I have also run brew install php71-mcrypt
extension=mcrypt.so has been included in the php.ini files, both on my machine and I have tried it inside the vagrant machine.
Any help would be much appreciated as I have been at this for 2 days now!
Since you are running vagrant, you need to install mcrypt within the vagrant machine. check which version of php you have installed on vagrant and install mcrypt using
sudo apt-get install *{mcrypt-version-here}*
restart apache using
sudo service apache2 restart
I had troubles of installing mcrypt-1.0.3 with PHP 7.1 on MacOS 12 Monterey.
~/projects/rest-api php -v
PHP 7.1.33 (cli) (built: Jun 7 2022 17:45:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
pecl install mcrypt-1.0.3 and pecl install --force mcrypt-1.0.3 failed with next error:
...
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/temp/mcrypt/configure --with-php-config=/opt/homebrew/opt/php#7.1/bin/php-config --with-mcrypt' failed
But I managed to install it with next command:
pecl install --force mcrypt-1.0.3 <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"
Last lines of result:
...
Build process completed successfully
Installing '/opt/homebrew/Cellar/php#7.1/7.1.33_4/pecl/20160303/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.3
Extension mcrypt enabled in php.ini
~/projects/rest-api php -m | grep mcrypt
mcrypt
Please see solution source.

Why Travis CI can't connect to GitHub API?

I'm running the following commands in Travis CI for my build:
before_install:
- curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
script:
- sudo composer -nqq update
I'm installing composer manually as I want to use sudo with it, as it's installed only for the user.
The error which I'm having are:
Updating dependencies (including require-dev)
- Installing jakub-onderka/php-console-color (0.1)
Downloading: Connecting... Failed to download jakub-onderka/php-console-color from dist: The "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1" file could not be downloaded (HTTP/1.1 403 Forbidden)
Now trying to download from source
- Installing symfony/yaml (v2.7.4)
Downloading: Connecting... Failed to download symfony/yaml from dist: The "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661" file could not be downloaded (HTTP/1.1 403 Forbidden)
Now trying to download from source
I've tried these links and they work fine.
Does it mean Travis is blocking GitHub API for some reason? If not, how do I fix it?
By fix, I mean either to know what's going on, or suppress these error messages (e.g. by using some special parameter in composer or changes to JSON file to force downloads from the source).
My composer.json file is:
{
"config": {
"vendor-dir": "/var/lib/vendor",
"bin-dir": "/usr/local/bin"
},
"require": {
"drush/drush": "dev-master"
}
}
For the reference, the full .travis.yml looks like:
before_install:
- env
- curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
- sudo apt-get -qy update
install:
- sudo apt-get install vagrant
script:
- set -e # This makes build to fail on first error.
- sudo composer -nqq update
- make
- make vm
after_failure:
- sudo apt-get -qy install tree && - tree -d -L 6 # Print directory structure in the form of a tree.
- env
sudo: true
language: php
python:
- "5.5"
Most probable reason for the error is limited amount of downloads from github. What you need to do is create a token in your github account and add it globally to your composer with
composer config -g github-oauth.github.com <your-token>
Source: https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
My suggestions are:
Remove:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo composer -nqq update
First line: not needed, because Composer is pre-installed, when you use language: php.
Second line: its better to execute composer install, because update uses the data from composer.lock if your repo contains one. And sudo is not needed here.
(Sidenote on the usage of sudo on Travis-CI:
sudo is only available in the non-containainer based infrastructure. I don't know if you really need this, but maybe you could switch to the faster container based infrastrucutre by setting sudo: false in your travis.yml, see http://docs.travis-ci.com/user/workers/container-based-infrastructure/ . Just a hint.)
Add to travis.yml
before_install:
- composer self-update
- composer install --no-interaction --optimize-autoloader
First line: update the (possibly) outdated composer of this Travis instance.
Second line: install dependencies described in composer.json with Composer.
The additional parameters to switch between downloading "Dist" or downloading "Source" are --prefer-dist and --prefer-source.
So its either
- composer install --prefer-dist --no-interaction --optimize-autoloader
or
- composer install --prefer-source --no-interaction --optimize-autoloader
Does it mean Travis is blocking GitHub API for some reason?
If its not a temporary issue, then its seems your Composer is running into the Github API rate-limit. The GitHub API allows only a low number of requests for unauthenticated users. You can raise the API limit by authenticating at Github from Travis.
See FAQ: https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
Please try it with prefer-source first.

Resources