Error installing composer

I have this problem, can u help? !

Based on your screenshot on the output from your screenshot, you’ve installed composer successfully.

You’re error has been triggered when trying to use composer to install Magento. You’re attempting to run the composer create-project command in a very unconventional directory (/root/test/). Not only is it unconventional, but according to the ls -l command that you ran you don’t have permission to edit the contents of that folder as the magento user.

Assuming that you’re following along with my tutorial, you missed a step at [41.38]. You need to first navigate to /var/www/html/ before running the composer create-project command. This will solve the error.

If you’re not following along with my tutorial, then navigate to whichever web directory that you’ve setup before running the composer create-project command.

Yes i have follow your turtorial, but when i want to navigate to /var/www/html it´s spitting out “No such file or directory” what to do? thats why i made a directory called “test” and clearly is not working

I’ve never come across this issue before. The /var/www/html/ directory is created by Apache when you install it.

When following the tutorial, what was the result when you got to this bit:

To test that Apache is working, we can run a super-quick test. Just put the IP address of your server in your browser. You should see a test page similar to this one.

Because if this works, then you have a web directory somewhere - Otherwise this page would not load. Plus the page will also confirm where your web directory is:

via the ssh client the screen look like this

composer create-project command will never initiate if there is something already in the folder. You must first check what files are in the web directory with ls -la, and then delete the files/folders. Only then can you run the command.

  • rm <filename> will delete a file (e.g. rm example.txt)
  • rm -rf <folder> will delete a folder and contents (e.g. rm -rf examplefolder)

Does the user ahmed which you’re executing the command from own /var/www/html/?

To check, run ls -la /var/www/ to display the folder owner permissions of the html folder. The user you’re logged in as, and the html/ folder owner should match.

Once you’ve corrected your user/permissions, don’t forget to empty the web directory again before executing the composer create-project command.