UBUNTU 18.04/19.10 安裝 PHP7.2 +Composer +nginx+Laravel+nodejs+github專案流程建立

PHP7.2+Composer+Larave+nodejs+github流程建立,從無到有的建立出一個php程式開發的環境,並加入GITHUB 上傳的專案流程

1.INSTALL PHP

sudo apt-get install php7.2 php7.2-cli php7.2-common php7.2-fpm php7.2-json php7.2-mbstring php7.2-mysql php7.2-readline php7.2-sqlite3 php7.2-xml php7.2-zip



2.INSTALL Composer

sudo apt-get install composer



3.Install Node.JS & npm

sudo apt-get install npm



4.Create First Laravel project

#composer create-project laravel/laravel [專案名] --prefer-dist composer create-project laravel/laravel laravel --prefer-dist





5.start npm & webpack

#cd [專案名]
cd laravel
npm install




6.RUN NPM

npm run watch




7.new Screen: Start Laravel http service:

php artisan serve


打完收工:
測試網址:http://127.0.0.1:8000
對外測試:
php artisan serve host 0.0.0.0

8.Install php-fmp & enable php7.2-fpm

sudo systemctl enable php7.2-fpm
service php7.2-fpm start


8. Install Nginx

sudo apt-get install nginx


10.edit nginx config file

sudo vi /etc/nginx/sites-enabled/default

################################
#root /var/www/html;
root /home/pi/laravel/public;

#Add index.php to the list if you are using PHP
#index index.html index.htm index.nginx-debian.html;
index index.php index.html index.htm index.nginx-debian.html;
 
location ~ .php$ {
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; 
}
location ~ /\.ht {             
    deny all;     
}



11.啟動nginx 並設定開機重啟

sudo service nginx restart
sudo systemctl enable nginx

http://localhost/index.php

終於完成了這篇好長的過程~ 謝謝大家的收看。

番外篇:

Github :https://github.com

i.在github 建立[你的專案]

mkdir temp
cd temp
git clone https://github.com/[你的帳號]/[你的專案]
mv [你的專案]/.git ../
cd ../
rm -rm temp




ii.建立上傳的過濾資料:.gitignore

vi .gitignore

以下是.gitignore的內容.這裡面的東西不會被git 傳上server

#內容:
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
#結束


iii.加入/COMMIT/然後上傳GIT

git.add .
git commit -m "init project"
git push

打完虛脫…..GG ….


Conclustion:

我們使用LINUX平台設定出php環境,開始開發PHP程式.




關於我:

JACCH SCRATCH 教學

JACCH是一個長期教自己小朋友的爸爸,在某個小小的工廠擔任資訊管理人員,編寫公司的ERP系統. 平時喜觀研究PYTHON,PHP,LINUX 等等的技術,也喜歡購買分享和開箱.
Facebook: https://www.facebook.com/twmakers
Discord 群: https://discord.gg/GPXbgqa






























產生APPLE手機和ANDROID手機的網頁ICON

<meta name="viewport" content="width=device-width, initial-scale=0.8 ,maximum-scale=0.8 ,user-scalable=no">
<meta name=”apple-mobile-web-app-capable” content=”yes”>
<link rel='apple-touch-startup-image' href='./assets/siripig-320.png' media='(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)' />
<link rel='apple-touch-icon' sizes='180x180' href='/assets/siripig-180-1.png' />
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
<link rel="icon" href="/assets/siripig-180-1.png" /> 
<meta name="application-name" content="SIRI 記帳本"/>
<meta name="msapplication-TileColor" content="#FFFFFF"/>
<meta name="msapplication-TileImage" content="/assets/siripig-180-1.png" /> 

自架 scratch 3.0伺服器給小朋友用

最近我花了一些時間在教小朋友使用scratch 3.0,發現sketch的3.0版本沒有辦法使用extension的功能,就是不能自己增加模組. 我們想要利用這個模組來抓取外在的天氣或者室內的溫度來應用, 所以我們決定自己架設這一個自自己的伺服器來使用

UBUNTU 18.04 版本環境設定:

sudo apt-get install nodejs npm git

安裝了GIT和 nodejs npm

安裝伺服器版本

git clone https://github.com/LLK/scratch-gui.git
cd scratch-gui
npm install

執行伺服器:

npm start

連結的網址:

http://localhost:8601/

就大功告成了

關於我:

JACCH SCRATCH 教學JACCH是一個長期教自己小朋友的爸爸,在某個小小的工廠擔任資訊管理人員,編寫公司的ERP系統. 平時喜觀研究PYTHON,PHP,LINUX 等等的技術,也喜歡購買分享和開箱.
Facebook: https://www.facebook.com/twmakers
Discord 群: https://discord.gg/GPXbgqa

Raspberry Pi Install Laravel php Nginx

安裝樹苺派的PHP+LARAVEL+NGINX

Install PHP 7.0

sudo apt install php7.0 php7.0-curl php7.0-gd php7.0-imap php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-xmlrpc php7.0-xml php7.0-fpm php7.0-zip php7.0-mbstring php7.0-sqlite3 php7.0-cli php7.0-readline -y


START php7.0-fpm

sudo systemctl enable php7.0-fpm
sudo service php7.0-fpm start


Install Composer

sudo apt-get install composer



Install NODEJS

sudo apt-get install npm


INSTALL NGINX

sudo apt-get install nginx


Create laravel

composer create-project laravel/laravel laravel –prefer-dist

sudo vi /etc/nginx/sites-enabled/default

################################
#root /var/www/html;
root /home/pi/laravel/public;

#Add index.php to the list if you are using PHP#index index.html index.htm index.nginx-debian.html;
index index.php index.html index.htm index.nginx-debian.html;
 
location ~ .php$ {
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 
}
location ~ /\.ht {             
    deny all;     
}

SETUP SERVICE

sudo service nginx restart
sudo systemctl enable nginx

打完收功

windows7休眠發生 0xc000000d錯誤解決方式

主要因為硬碟錯誤造成開機MBR記錄了一條無效的休眠記錄.

使用BOOTIC 讀取資料一次之就可以清除掉開機的暫存記錄.

就可以重新開機,在兩次重開後他會開始修得硬碟.

之後就可以重開成功了.

但這也代表硬碟可能有所錯誤了.