DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Install PHP Composer via SSH for Dependencies Management of Your Cloud App

Install PHP Composer via SSH for Dependencies Management of Your Cloud App

In this post we take a look at how to install the popular PHP dependency management tool, Composer, via SSH to help with our cloud-based PHP applications.

Tetiana Markova user avatar by
Tetiana Markova
·
Nov. 17, 16 · Tutorial
Like (1)
Save
Tweet
Share
8.62K Views

Join the DZone community and get the full member experience.

Join For Free

php composer guide to consolidate and centralize the management of dependencies can be a real problem for complex cloud applications. that is why the right decision here is to use already-proven, on the market dependency management tools.

composer is one of the most popular dependency management solutions for php, inspired by node’s npm and ruby’s bundler . it smartly manages all the required libraries and packages for your application. running on a per-project basis, composer determines which versions of which packages your project depends on and installs them in a working directory. moreover, this tool provides automatic updates load , allowing to keep your packages actual.

follow the instructions below to install php composer via jelastic ssh gateway and perform its configuration, that will enable us to execute it from any working directory throughout a server.

1. in order to run the composer installation by means of jelastic ssh gateway , you need to:

  • generate an ssh keypair.
  • add your public ssh key to the dashboard.
  • access your account via ssh protocol.

once you’ve established ssh connection to your apache php or nginx php server ( apache 2.4 in our example), you can easily integrate composer into your project.

2. run the composer installer from inside your server working directory to download the appropriate composer.phar archive:

curl -ss https://getcomposer.org/installer | php


php composer

3. rename the composer.phar file to just “ composer ” and move it to the private bin directory with the below commands:

mkdir ~/bin mv ~/composer.phar ~/bin/composer

install php composer

4. now, let’s add composer to the server path variable in order to be able to further execute it from any server directory. in such a way, you won’t have to write out the full path (i.e. /var/www/bin/composer ) for calling this dependencies manager when necessary.

for that, run one of the following commands depending on used application server:

  • for apache php :
export path=$path:/var/www/bin echo 'export path=$path:/var/www/bin' >> ~/.bash_profile

php composer ssh

  • for nginx php :
export path=$path:/var/lib/nginx/bin echo 'export path=$path:/var/lib/nginx/bin' >> ~/.bash_profile

php composer path
that’s it! composer is added to your path variable now.

5. everything is already set up! you can run the following command in order to ensure that php composer works as intended:

composer about

php composer manager

great! start using composer on your apache or nginx server and easily control dependencies within your php projects.

if you face any issues while installing php composer via jelastic ssh gateway, feel free to appeal for our technical experts’ assistance at stackoverflow .

Composer (software) Dependency PHP Cloud app

Published at DZone with permission of Tetiana Markova, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Container Security: Don't Let Your Guard Down
  • How To Handle Secrets in Docker
  • Custom Validators in Quarkus
  • A Beginner's Guide to Infrastructure as Code

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: