Modify MAC default PHP runtime Environment, configure global Composer for MAMP

Source: Internet
Author: User
Tags php example
In the absence of a global Composer, if you run the Composer command in a directory that does not have Composer installed, such as: The Create-project system will return:

 
   
    
  Could not open input File:composer.phar
 
   
Well, come and find out why, take a look at Composer's documentation says to move the Composer to the/usr/local/bin directory:

 
    
     
  MV Composer.phar/usr/local/bin/composer
 
    
Run the Composer command again, or the same ah, to turn over the Composer document, all Composer commands have a PHP example:

 
     
      
  PHP Composer.phar Update
 
     
Composer relies on PHP, OK, at least not Composer problem, it may be the problem of PHP, we all know that the MAC factory when the system pre-set a PHP and we use the MAMP php, probably the problem is here, in the Terminal run a bit :

 
      
       
  Which php/usr/bin/php
 
      
The problem is confirmed, is the PHP problem, exactly is the PHP environment configuration problem, to manually configure the environment it:

 
       
  
        sudo nano ~/.bash_profile
  
        # adds a row. Note PHP5.4.10 changes to the name of the PHP version directory that you are running
  
        export path=
  
        "/applications/mamp/bin/php/php5.4.10/bin: $PATH"
  
        # Save, Exit
  
        # Run the. bash_profile file : Bash_profile
  
        # Verify which PHP which PHP/APPLICATIONS/MAMP/BIN/PHP/PHP5 is currently running.
  
        4.10/bin/php
 
       
Well, so far the PHP runtime environment has been configured to reinstall Composer:

 
         
          CD /usr/local/bincurl 
         -s  s Https://getcomposer.org/installer | Phpcomposer successfully installed to:/usr/local/bin/composer.pharuse it:php composer.phar 
          # Modify Composer.phar Permissions for file  
          sudo  chmod a+x composer.phar 
         

Pmicrosoft Yahei ', Sans-serif; font-size:14.9499998092651px; letter-spacing:1.5px; Margin-top:0px!important "> Oh, come on, run the Composer command:

 
          
           CD /my/project/path 
           # Note that there is no need to add PHP in front of the Composer.phar command  COMPOSER.P Har create-projectcomposer.phar self-updatecomposer.phar installcomposer.phar update 
          
Fix it! At this time, should eat meal, should go to bed goes to bed.

Above describes the modification of the MAC default PHP runtime environment, to MAMP configuration global Composer, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.