安裝composer -vvv的參數是表示展示安裝進度,測試時使用其他參數安裝失敗,一直卡著不動
curl -vvv https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
apt-get install git
在創建項目之前,要安裝php的擴展和unzip命令,沒有這幾個擴展后面創建項目不成功
apt-get install php7.3-mbstring php7.3-zip apt-get install unzip
如果遇到警示,不準使用root執行,可以直接忽略不用管就行,沒必要使用一個非root用戶。
先把鏡像站給設置了,再去創建項目,否則會卡住一動不動
composer config -g repo.packagist composer https://mirrors.aliyun.com/comp oser/composer create-project topthink/think=6.0.x-dev thinkphp
框架代碼下載完成后,要把根目錄的.example.env 改成.env,這樣默認是開啟了調試模式,可以看到代碼中的錯誤。
配置nginx的重寫用來去除index.php前綴,配置pathinfo變量傳遞才能使用tp6.0的路由。
thinkphp下的nginx配置文件如下:
server { listen 80; server_name tp.com; access_log /var/log/nginx/tp.com.access.log main; error_log /var/log/nginx/tp.com.error.log; root /var/www/html/thinkphp/public; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?s=$1 last; break; } location / { index index.html index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } }
掃碼二維碼 獲取免費視頻學習資料
- 本文固定鏈接: http://phpxs.com/post/7286/
- 轉載請注明:轉載必須在正文中標注并保留原文鏈接
- 掃碼: 掃上方二維碼獲取免費視頻資料
查 看2022高級編程視頻教程免費獲取