Troubleshoot Linux using PHP commands-base Comment not found and install composer

Source: Internet
Author: User

Get the installation directory for PHP

Use Find/-name php.ini to see where PHP is installed

/usr/local/php/lib/php.ini
# CD to/usr/local/php/lib/php.ini directory, view php file permissions
LS-Ltotal59464-rwxr-xr-x1Root root837Jan to 2018Pear-rwxr-xr-x1Root root858Jan to 2018Peardev-rwxr-xr-x1Root root774Jan to 2018pecllrwxrwxrwx1Root root9Jan to 2018PharPhar.phar-rwxr-xr-x1Root root53494Jan to 2018Phar.phar-rwxr-xr-x1Root root30458256Jan to 2018PHP-rwxr-xr-x1Root root30345152Jan to 2018php-CGI-rwxr-xr-x1Root root2382Jan to 2018php-Config-rwxr-xr-x1Root root4538Jan to 2018Phpize
Setting environment Variables for PHP

First look at the current environment variables

Echo $PATH
#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Here we see that there is no PHP, so we add PHP in

Export path= $PATH:/usr/local/php/bin

View all environment variables using the Echo $PATH

:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/php/bin

Test at any location using PHP commands

php- version 5.6.  -  to 2018 All:1997-the  PHP groupzend Engine v2. 6.0 1998- Zend Technologies
Install global composer
# This command is used to download a Composer.phar file
Curl-ss https://Getcomposer.org/installer | php

The installation succeeds as follows

Global Use composer command, Composer.phar move into bin

MV Composer.phar/usr/local/bin/composer

Troubleshoot Linux using PHP commands-base Comment not found and install composer

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.