PHP Composer problem

Hello Friends,
Recently I encountered an issue related to PHP composer. PHP Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. It does not comes along with your PHP installation, you need to install it separately if you need it. You can learn more about PHP composer in the links below:

Now coming to the issue I have faced. When I attempt to update the PHP composer libraries, I was getting some strange output. Please see below:
sms@test ~]# php composer.phar update
sms@test ~]#

While updating the coposer, it is supposed to check the libraries which my project requires,  and update the necessary. We should be getting some thing like this:pharcomposerOP
So I was checking why it is showing some special characters in output instead of installed or updated dependencies. After intensive searching, I found that we need to change the php variable “detect_unicode” in php.ini.
detect_unicode = Off

Once this is done and Apache restarted, you should be able to get the proper output while running composer update.

Sometimes you may get something like this.
sms@test ~]# php composer.phar update
Could not load package monolog/monolog in [UnexpectedValueException] Could not parse version constraint >=0.90 <3.0: Invalid version string
“0.90 <3.0”
Could not parse version constraint >=0.90 <3.0: Invalid version string “0.90 <3.0”

Here it says that the current version of package “monolog” is conflicting with the other packages of composer. Please note that while installing the Composer for your project it will determine and save the necessary packages list and their versions in a file called “composer.json”.

I tried to edit the version number for that package in that file but I was getting same error with another package. So I have to update all the packages without conflicting one another. So I have to run the following command.
sms@test ~]# php composer.phar self-update
Updating to version e727ed4d7305110b5f39689e47a637be19316483.
Downloading: 100%
Use composer self-update –rollback to return to version 533eeddcb7575f11ddf1d9893237ab1fa0ec1fc9

Now all done. Everything is fine. Please note that you will have to do it for all the projects in your server separately. It can be installed either server wide or for single domain. Just need to determine what kind of installation it is.

All izz well !!! Have a Great Day !!! 🙂


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s