How to set environment variables when installing php under linux

藏色散人
Release: 2023-03-11 08:20:01
Original
1860 people have browsed it

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
Copy after login
Copy after login

Permanent configuration

vim ~/.bashrc
Copy after login

Add at the end

export PATH=$PATH:/usr/local/php/bin
Copy after login
Copy after login

Make the configuration effective

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!