以下由composer教學專欄為大家介紹centos7.7安裝php7.3的lnmp環境和composer詳細步驟,希望對需要的朋友有幫助!
1.更新來源<br> yum update
<br>2.安裝nginx<br> yum install nginx
<br><br><br>
<br><br>
<br><br><br><br><br>
<br><br>
<br>
<br><br><br><br><br>#3.啟動nginx<br> <br>service nginx start<br><br>4.訪問http://你的ip<br>
<br>5.安裝mysql:<br>
<br> 安裝mysql來源 yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7. noarch.rpm<br> 安裝: yum install mysql mysql-server<br> 啟動: /etc/init.d/mysqld start service mysqld restart<br>
<br>
<br>
<br><br>
<br><br><br>
<br>
<br>
她:mysql -u root -p
幾率錯誤Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)<br># 原因:權限問題
<br> 解決: sudo chown -R root:root /var/lib/mysql (兩個root都可以改為擁有者,但是需要保持一致)
<br>
service mysqld restart<br><br>
登陸mysqlmysql -u root -p //按回車直接可以登陸,剛安裝完mysql是沒有密碼的
修改mysql密碼######### use mysql;### 低版本修改:update user set password =password('你的密碼') where user='root';###### 高版本修改:update user set authentication_string = password('你的密碼'), password_expired = 'N', password_last_changed = now( ) where user = 'root';### alter user 'root'@'localhost' identified by '你的密碼';### 如果說密碼強度不夠,可以查看密碼等級:LISHOW VARIpass LISHOW %" ;### 然後設定為低等級:SET GLOBAL validate_password_policy=0;### 最後退出;### ###exit;###### 伊提.必要時加入以下命令列,為root新增遠端連線的能力。連結密碼為'你的密碼'### GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密碼' WITH GRANT OPTION;### FLUSH PRfIV; .開啟my.cnf檔### 新增一行bind-address=0.0.0.0### 3.重啟mysql######6.安裝php### yum install php #####6.安裝php### yum install php #####6.安裝php### yum install php php-develphp 版本### 如果想安裝7.3### 首先安裝EPEL 來源######1.yum install epel-release //安装 EPEL 源 2.yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm //安装 REMI 源 3.yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml### 4.PHP的安裝目錄/etc/opt/remi/php73/ php .H.PHP的安裝目錄/etc/opt/remi/php73/ php php.ini也在裡面找到? .ini 裡面fix_pathinfo 修改成0 但是不能看phpinfo();###### 操作######
systemctl restart php73-php-fpm #重启 systemctl start php73-php-fpm #启动 systemctl stop php73-php-fpm #关闭 systemctl status php73-php-fpm #检查状态###7.最後在yum updatephp資源#8.安裝composer### ###curl -sS https://getcomposer.org/installer | php73### mv composer.phar /usr/local/bin/compose###r### 這樣。會報錯誤:###/usr/bin/env: php: No such file or directory###### 解決方法### ###cd usr/bin### cp php#73 php######在輸入composer就好了###### 更改鏡像為阿里雲:###composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/############################################################################################################### 9.安裝git### ###yum -y install git#########10.下載laravel框架### ###composer create-project --prefer-dist laravel/laravel####composer create-project --prefer-dist laravel/laravel##############專案名稱"6.*"###
composer create-project --prefer-dist laravel/laravel laravelxs "6.*"### 修改composer檔。 ### ###
cd /root/.config/composer/ vi auth.json { "bitbucket-oauth": {}, "github-oauth": {}, "gitlab-oauth": {}, "gitlab-token": { "github.com": "在git上生成的token" }, "http-basic": {}, "bearer": {} }### 新增### "github.com": "在git上產生的token"######### 11.nginx網域的設定###### 「建立建立建立建立建立建立」建立」建立建立建立建立建立資料品的檔案圖###### 」建立「文件:網域.conf ###### 裡面的內容:###
server{ listen 80; server_name 你的域名; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; index index.html index.htm index.php; root 你的项目目录; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_connect_timeout 180; fastcgi_read_timeout 600; fastcgi_send_timeout 600; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(html|htm|js|css)?$ { expires 8h; } }
以上是centos7.7如何安裝php7.3的lnmp環境與composer的詳細內容。更多資訊請關注PHP中文網其他相關文章!