Pura
Pura

Reputation: 141

Installing PHP Project Dependencies with Composer

I am trying to install Nette2.3.1 using Composer (on XAMPP). In c:\x\php folder I run this command:

composer create-project nette/sandbox myprojectname

When I do this, getting following error:

[Seld\JsonLint\ParsingException] "c:\x\php\php.exe" does not contain valid JSON Parse error on line 1: MZÉ ♥ ♦    ╕ ^ Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

I tried all these options to no avail:

  1. removed the project directory and tried
  2. ran this command inside htdocs folder
  3. ran this through PHP JetBrains console
  4. made sure that the Composer version is the latest one

What was wrong?

This was what went wrong:

  1. I installed xampp while anti-virus is running - i got a warning but chose to ignore that. Consequently php.exe was corrupted and messed up the whole thing for me.

  2. PATH variables under my user wasn't updated with php.exe path. Though system variable is updated, it is still a mystery to me why this became an issue.

How I did to correct this:

Removed xampp altogether, cleared composer cache and installed wamp this time and created project for nette sandbox. This worked fine. In all fairness xampp would have worked as well had I installed it with av disabled and PATH variables properly updated.

Upvotes: 1

Views: 3300

Answers (1)

samuel
samuel

Reputation: 361

I think your composer PATH or shortcut/batch file is kind of broken, because it tries to read the php.exe file as a JSON file.

Try to remove composer completely and start with a clean install

  1. Download and install composer using the automated installer. It sets up the PATH for you, so you can just call composer from anywhere.
  2. Close the command line terminal and start a new one (important).
  3. Try to run the composer create-project nette/sandbox myprojectname command in any directory

Documentation - windows installation of composer

Upvotes: 1

Related Questions