1
votes

I have successfully installed Composer in the root directory (that was the default choice) on my Linux/Apache server using their installation guide.

http://socketo.me/docs/install

It says I need to "create a file called composer.json in your project folder". So I created that file (with the contents they gave on top of their's page) using the notepad and filezilla to download the file to my application's root directory.

Then I open Putty and type: cd /var/www/websocket (application directory, where already was placed json file)

Then I run Composer using:

php ~/composer.phar install

and get following error:

[Seld\JsonLint\ParsingException] "./composer.json" does not contain valid JSON Parse error on line 1: php ~/composer.phar ^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

My composer.json file contains, in accordance to instructions,

php ~/composer.phar require cboden/ratchet

What I should to do to install it properly?

1
error says it all. Post your json file contents.pinkal vansia
Once you have composer.phar on your system (for this documentation, we're going to assume it's in your home directory) create a file called composer.json in your project folder. Inside that file copy and paste the JSON from the top of this page. So, composer.json file contains: "php ~/composer.phar require cboden/ratchet" (without ")Areso

1 Answers

3
votes

composer.json should only contain valid json string. Following is not a json

php ~/composer.phar require cboden/ratchet

Replace composer.json content with the following,

{
  "require" : {
     "php": ">=5.4.2",
     "cboden/Ratchet": "dev-master"
  }
}

And then run following command from the same directory that contains composer.json

php ~/composer.phar update

For detailed schema of composer.json read this.