Home  >  Article  >  Backend Development  >  How to set environment variables when installing php under linux

How to set environment variables when installing php under linux

藏色散人
藏色散人Original
2021-07-05 10:18:321933browse

How to install and set php environment variables under Linux: 1. Add "export PATH=$PATH:/usr/local/php/bin"; 2. Set "vim ~/.bashrc"; 3. Tail Add "$PATH:/usr/local/php/bin".

How to set environment variables when installing php under linux

The operating environment of this article: linux5.9.8 system, PHP7.1 version, installed under DELL G3 computer

linux How to set php environment variables?

linux configure php environment variables and install composer

Add the following environment variables:

export PATH=$PATH:/usr/local/php/bin

Permanent configuration

vim ~/.bashrc

Add at the end

export PATH=$PATH:/usr/local/php/bin

Make the configuration effective

source ~/.bashrc
1、下载composer
curl -sS https://getcomposer.org/installer | php
2、将composer.phar文件移动到bin目录以便全局使用composer命令
mv composer.phar /usr/local/bin/composer
3、切换国内源
composer config -g repo.packagist composer https://packagist.phpcomposer.com

4. Enter composer to verify

Successful installation

Recommended learning: "PHP Video Tutorial

The above is the detailed content of How to set environment variables when installing php under linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn