一,配置PHP命令可以直接访问:

1,把php的bin目录加入到$PATH变量中
root@lhdpc:~# vi /etc/profile
增加内容:
export PHP_HOME=/usr/local/soft/php8
export PATH=$PATH:$PHP_HOME/bin
使生效
root@lhdpc:~# source /etc/profile
测试效果:
root@lhdpc:~# php --version
PHP 8.1.1 (cli) (built: Dec 20 2021 16:12:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies


二,安装curl

1,查看是否安装了curl
root@lhdpc:~# whereis curl
curl:
2,安装curl
root@lhdpc:~# sudo apt-get install curl
3,查看安装效果:
root@lhdpc:~# curl --version
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 libidn2/2.3.1 
libpsl/0.21.0 (+libidn2/2.3.0) libSSH/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

三,安装composer
1,检查是否已安装composer

root@lhdpc:~# whereis composer
composer:

2,安装composer

root@lhdpc:~# curl -sS https://getcomposer.org/installer | /usr/local/soft/php8/bin/php
All settings correct for using Composer
Downloading…

Composer (version 2.2.0) successfully installed to: /usr/local/source/composer.phar
Use it: php composer.phar

3,移动composer到/usr/local/bin目录下

root@lhdpc:~# sudo mv composer.phar /usr/local/bin/composer
liuhongdi@lhdpc:/usr/local/soft$ composer –version
Composer version 2.2.0 2021-12-22 11:03:27

 

 

参考 https://www.cnblogs.com/architectforest/p/15725371.html

发表回复

后才能评论