am trying to install illuminate/html package in Laravel 5.1 using command composer require illuminate/html . But I get this error.
[ErrorException]
file_put_contents(C:\ProgramData\ComposerSetup\bin):
failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update]
[--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs]
[--sort-packages] [packages1] ... [packagesN]
I believe Problem is permission to access that folder, I tried to remove read only protection but the protection return by default.
Am running Windows10
I had a similar problem recently, and needed to change the permissions of my folders.
By running:
php artisan cache:clear
chmod -R 777 storage vendor
composer dump-autoload
I was able to give all the permissions required to open files and write to them etc
Try running the Windows Command Prompt as an Administrator -- this worked for me.
I had this problem too. I put this solution here in case it works for someone else.
On my system (Windows 10), I had marked both the vendor folder and the composer.json file in my project folder as hidden, because of reasons. The error message went away when I unhid the folders and the json files, and ran the command again. I did not need to restart my command line in Administrator mode. (In fact, trying this in Administrator mode did not work either, until I changed the file and folder properties to unhidden.)
Related
I've installed composer globally. After the download, I've followed the instructions and added:
mv composer.phar /usr/local/bin/composer
So, now, I'm getting in the folder /var/www/html/buscador and tried to install a project. The Github instruction indicates that I should use:
composer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0
But using it I get:
file_put_contents(./composer.json): failed to open stream:
Permission denied
I've looked for an answer to this, so I've tried this: (rosamunda is my user)
sudo chown -R rosamunda ~/.composer/
It ask for my password and then I get:
chown: cannot access '/home/rosamunda/.composer/': No such file or
directory
What am I doing wrong?
You need to run composer init before running composer require ..., this will create the composer.json file in the directory
I am totally new to laravel. I would like to use it in my project
I downloaded WAMP Stack 7.1.26-2 from http://bitnami.com and to my surprise,it already came with laravel pre-installed.
It is in the frameworks folder as in:C:\Bitnami\wampstack-7.1.26-2\frameworks
But my problem is that I do not kinow how to use laravel from there.It is not in the htdocs folder as I think it s supposed to be.
If I go to http://localhost I see only the bitnami welcome page
If i go to http://localhost/laravel ,it says PAGE NOT FOUND
I searched online for the answer but most of the time,it points me to this link:
https://docs.bitnami.com/google/apps/#laravel
But on that page, I see NOTHING relating to laravel.I cannot even find the word 'laravel' with a browser search.
If I run composer create-project laravel/laravel myproject --prefer-dist ,
I get this:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\o.o amoo>composer create-project laravel/laravel myproject --prefer-dist
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Bitnami/wampstack-
7.0.0RC7-/php/ext\php_solr.dll' - The specified module could not be found.
in Unknown on line 0
Installing laravel/laravel (v5.5.28)
- Installing laravel/laravel (v5.5.28): Loading from cache
Created project in myproject
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Bitnami/wampstack-
7.0.0RC7-/php/ext\php_solr.dll' - The specified module could not be found.
in Unknown on line 0
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 73 installs, 0 updates, 0 removals
- Installing symfony/thanks (v1.1.0): Loading from cache
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Invalid zip file, retrying...
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Invalid zip file, retrying...
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Failed to download symfony/polyfill-ctype from dist: 'C:\Users\o.o amoo\
myproject\vendor/symfony/polyfill-ctype/4199a310f6ba3768faedee6d521ec615' is not a zi
p archive.
Now trying to download from source
- Installing symfony/polyfill-ctype (v1.10.0): Cloning e3d8262452
[RuntimeException]
Failed to clone https://github.com/symfony/polyfill-ctype.git via https, ssh p
rotocols, aborting.
- https://github.com/symfony/polyfill-ctype.git
Cloning into 'C:\Users\o.o amoo\myproject\vendor\symfony\polyfill-ctype'...
fatal: unable to access 'https://github.com/symfony/polyfill-ctype.git/': Fa
iled to connect to github.com port 443: Timed out
- git#github.com:symfony/polyfill-ctype.git
Cloning into 'C:\Users\o.o amoo\myproject\vendor\symfony\polyfill-ctype'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--r
epository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no
-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vc
s] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<dir
ectory>] [<version>]
C:\Users\o.o amoo>
That made me soo confused.It did make a project called myproject was made in : C:\Users\o.o amoo>
but laravel couldn't be installed???
If I try php artisan serve I get:
Could not open input file:artisan
So with that,can I access myproject with laarvel if so,how?If not how come and what do I do?
Someone please point me in the right direction...
Thanks!!!
Alright let's start with why your project is installed in C:/Users it's because you use --prefer-dist in composer create-project laravel/laravel myproject --prefer-dist.
--prefer-dist: Reverse of --prefer-source, composer will install from dist if possible. This can speed up installs substantially on build
servers and other use cases where you typically do not run updates of
the vendors. It is also a way to circumvent problems with git if you
do not have a proper setup.
Second you run into errors maybe because you are in a directory that require additional rights, at least that's how it looks to me.
If you have installed Laravel correctly you should be able to navigate trough a terminal to the desired location, and either use laravel new BUT only if you are already in the directory that you want say C:/Code/myproject if you are still in C/Code you need to do laravel new myproject
If this doesn't work for you I would suggest you to verify that you installed everything according to the docs
And last but most important I want to mention 1 more thing for you, in Laravel it is really more convinient to use Homestead. You can read more for what is Homestead, how to install, configure and work with it here :
https://laravel.com/docs/5.8/homestead
Good day people, I have been having this problem for days now, when I try to download dependencies for my php project using composer I get this error
c:\wamp64\www\Test>composer global require "fxp/composer-asset-plugin:^1.3.1"
Changed current directory to C:/Users/Nwachukwu Favour/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, reverting ./composer.json to its original content.
[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2014%241cf88bd0ed4076dc091407477ba2a76483e8598ee5365673381262e6c1d40fcf.jso
n" file could not be downloaded: failed to open stream: HTTP request failed!
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
I am running a windows 10 OS and am suspecting that my system cannot download from the command line. I would be very glad if someone can help me solve this problem because it is hindering my project. Thanks in advance.
You could also run this command on the CLI before installing any dependencies. It forces composer to use https to download all resources:
composer config -g repo.packagist composer https://packagist.org
The issue could be caused by the redirect from http to https. (or your firewall blocking the call)
According to this article the problem could be solved by adding the following to your composer.json:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Forcing composer to use https connections to Packagist
I just updated my composer to the latest version and this problem is solved.
Try
composer self-update
To know the current version and update details:
composer diagnose
I tried the command below and it worked.
composer config -g repo.packagist composer https://packagist.org
This is just one of the options given above.
I found enabling OpenSSL extension in the php.ini-development/production file fixed the problem.
Its located within your PHP install
just stop your antivirus software :)
for some reason antivirus software kaspersky doesn't like composer :(
I had the same error tried everything... nothing worked.
I remembered I had issues with composer in the past while my AV was on... turned it off and composer worked like a charm :)
just put this in command
composer config -g repo.packagist composer https://packagist.org
Update or Delete your 'http_proxy' variable.
Delete composer
Install Composer again
Restart your machine.
Your are good to go.
try with composer diagnose and after that composer update -vvv
I had the same error, but it was resolved in a different way for me. I used to give sudo to composer commands because folder /home/aspire/.composer is in sudo permission. I changed it to sudo chown $USER /home/aspire/.composer.
I changed the permissions as I mentioned and I ran the code
sudo composer require symfony/orm-pack
Throws error
[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded:
Then I tried
composer require symfony/orm-pack
It works
If anyone know the exact reason, please comment
if you are in china like me,try this:https://developer.aliyun.com/composer
github connection not stable recently.I tryed https://pkg.phpcomposer.com/ first but don't work. I tryed composer diag and composer -vvv and wait.out put show cache file is :Writing C:/Users/Administrator.000/AppData/Local/Composer/repo.so i copy cache file from my colleague,and it works first,laravel run,but composer require show 404.then i found the solution above.try composer update -lock and change the repositories url to ali's.And solved.
This problem happened to me, and I solved it by turning off the firewall.
This is one of the solutions.
If you have http_proxy environment variable, just delete it from either User variables or System variable and save yourself from all this trouble.
Now I remember why I never got into PHP. It's such a pain to set up. I spent a couple hours today trying to complete a coding challenge which required me to install Composer, Vagrant, VirtualBox and Laravel.
Somewhere along the line I think my permissions or something changed, because whenever I try to install Laravel...
composer global require "laravel/installer"
I get...
Changed current directory to /home/dilraj/.composer
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
I am not sure why I am getting this, perhaps it is because I have already done it, but regardless, when I try to create an executable command I am not seeing any results.
I edited the .bashrc file, as such...
export PATH="$PATH:$HOME/.config/composer/vendor/bin
source ~/.bashrc
I am not going to lie, I don't what this is even doing. I just want to make it so I can type 'laravel' and then start doing stuff, kinda like in npm.
Here are other things I tried but succeeded without any luck :(
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
alias laravel='~/.config/composer/vendor/bin/laravel'
You don't you address the issue noted in the error, primarly Permission denied. Running chmod 755 .composer should be enough to give you permission to edit the file.
If that doesn't work, add sudo in front of it to update it using root account.
seems like you have install composer as root.
You can try to install laravel without Laravel Installer by run :
composer create-project --prefer-dist laravel/laravel projectfolder
It its not working, try using sudo command :
sudo composer create-project --prefer-dist laravel/laravel projectfolder
I'm trying to install Laravel on WSL. I have everything install so far but when I run the laravel command, I get a Permission Denied from ZipArchive. Is there a way around this?
Things I've tried:
Directory is 777 -r
Owner of directory errored with my user and www-data
Making the file 777
PHP Warning: file_put_contents(/var/www/laravel_*.zip): failed to open stream: Permission denied in /home/jeff/.composer/vendor/laravel/installer/src/NewCommand.php on line 132
PHP Warning: ZipArchive::extractTo(): Permission denied in /home/jeff/.composer/vendor/laravel/installer/src/NewCommand.php on line 150
PHP Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /home/jeff/.composer/vendor/laravel/installer/src/NewCommand.php on line 152
Composer could not find a composer.json file in /var/www
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Application ready! Build something amazing.
Try to run the bash as Admin. And use composer create-project --prefer-dist laravel/laravel to create laravel project than using the global laravel installer.
Do try Laragon if you want to develop in windows.