Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hafizameerhamza1's avatar

[ErrorException] file_get_contents(C:\xampp\php): failed to open stream: Permission denied

Hi everyone, I am here to get some help. I am new to Laravel. I want to learn Laravel. I am using window 10. I have installed the Composer on my system. Now I am trying to install Laravel using the below command composer global require "laravel/installer"

But when I try to run this command in cmd I got this error every time.

[ErrorException] file_get_contents(C:\xampp\php): failed to open stream: Permission denied

It's denied some permissions. I changed the system permissions to everyone. But It never solved my problem. I am not sure why this error appears. I search around the internet and different forums. But I did not find any suitable solution. I tried my ways to solve this problem (As other people suggest me to do). But I am still stuck with this error. I know it may be a very basic error. But I am new and I don't know what to do and how to solve this problem. Here is the screenshot added for your reference.

0 likes
9 replies
D9705996's avatar

Do you have UAC turned on in Windows? If so try open command prompt as administrator and try again.

hafizameerhamza1's avatar

yeah. its already turned on and I run cmd as an administrator. But getting this error. Can you help me ?

D9705996's avatar

To rule out a general issue with composer what happens when you run this from command prompt

composer -V
Composer version 1.0.0 2016-01-10 20:34:53

Do you get something similar or an error?

hafizameerhamza1's avatar

I am getting an error. Now I have installed Laravel project with some other command but I don't know where the project is created? And getting this error now [InvalidArgumentException]

Here this is what command I executed and below is the result for this command.

C:\WINDOWS\system32>composer create-project --prefer-dist laravel/laravel blog "5.4.*" Installing laravel/laravel (v5.4.30)

  • Installing laravel/laravel (v5.4.30): Downloading (100%) Created project in blog

[InvalidArgumentException] Composer could not find the config file: C:\xampp\php To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting S tarted" section

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [] [] []

How to solve this problem

hafizameerhamza1's avatar

I run this (composer -V) command successfully. But when I try to install a laravel project I am getting this error every time.

C:\xampp\htdocs>composer create-project laravel/laravel laravelproject "5.4.*" Installing laravel/laravel (v5.4.30)

  • Installing laravel/laravel (v5.4.30): Loading from cache Created project in laravelproject

[InvalidArgumentException] Composer could not find the config file: C:\xampp\php To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting S tarted" section

D9705996's avatar
D9705996
Best Answer
Level 51

It looks like this error can be caused by having a Composer environment variable set.

If you run echo %COMPOSER% does it print anything. if so can you try set COMPOSER= and rerun

composer create-project laravel/laravel laravelproject "5.4.*"

If this works you will need to remove the environment variable permanently as the above is only for the current command prompt session

Composer Github Issue - https://github.com/composer/composer/issues/1720

2 likes
hafizameerhamza1's avatar

Hi Sir, Thanks for your help. your guidance helps me a lot and now the problem is fixed.

First I run both echo %COMPOSER% and set COMPOSER= commands, both run successfully. Then I removed Composer environment variables and rerun the project command, then it installed the project successfully in my directory.

Thanks again :)

1 like
gcilinskas's avatar

Hello. I have similar problem, when i try to run composer global require "laravel/installer". but my error looks like this : [ErrorException] file_get_contents(C:\Users\Moe): failed to open stream: Permission denied

What can be wrong in my situation? Cannot find any solutions at the moment

Please or to participate in this conversation.