PHP
中文教學
https://sites.google.com/site/phplearnmark/php
PSR規範
執行緒
fork
http://www.huyanping.cn/基于pcntl的php并发编程/
php commad
php有那些模組
php -m
分詞
11種分詞 http://www.199it.com/archives/446615.html
Session 機制
http://www.cnblogs.com/wangtao_20/archive/2011/02/16/1955659.html
ADODB
https://www.php5.idv.tw/documents/ADODB/ 文件
phpunit
https://phpunit.de/manual/5.7/zh_cn/installation.html
PHP模組詳解
https://segmentfault.com/q/1010000004330024
php 常用套件
jieba 結巴分詞
scws
ref: https://github.com/hightman/scws/tree/master/phpext https://github.com/hightman/scws/blob/master/phpext/README.md http://blog.sina.com.cn/s/blog_54fd6b710101as5c.html
xdb產生 http://blog.sina.com.cn/s/blog_54fd6b710101as5c.html
php學習誌 https://sites.google.com/site/phplearnmark/php
Fatfree Framework (F3)
http://blog.csdn.net/modiziri/article/details/21497111#comments https://fatfreeframework.com/3.6/home https://github.com/bcosca/fatfree
環境部署
資料庫
PDO
ADODB
http://achi.idv.tw/book/export/html/2046
Composer
安裝方式
https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '61069fe8c6436a4468d0371454cf38a812e451a14ab1691543f25a9627b97ff96d8753d92a00654c21e2212a5ae1ff36') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
$ sudo mv composer.phar /usr/local/bin/composer # 搬到全域環境並改名成 composer 方便操作
註: 安裝於全域環境(Globally), 升級就會需要 sudo composer self-update
自己升級: sudo composer selfupdate # composer 升級
套件升級: composer update
演算法
SCWS – 簡易中文分詞系統
session
http://www.webtech.tw/info.php?tid=33
程式
php empty, is_null , isset 差異
http://seanphpbook.blogspot.tw/2009/10/php-empty-isset-php.html
通用function
explode 字串切割 strpos 查字串第一次出現位置 implode() 陣列組成字串
Array 函式 http://www.w3school.com.cn/php/php_ref_array.asp array_unshift 組數插入新值 array_unshift(array,value1,value2,value3...) array_unique() 删除数组中的重复值 array_values() 返回数组中所有的值 array_pop() 删除数组的最后一个元素
PHP有載入那些Module
#列出所有已載入的模組
print_r(get_loaded_extensions());
echo "xml modules\n";
#列出模組XML, 的所有FUNC
print_r(get_extension_funcs("xml"));
shell >>
> php -m
預設模組載入路徑
> /etc/php.d/
> ls /usr/lib64/php/modules/
Phar
http://scar.tw/article/2013/01/09/php-phar-create-and-use/
Q&A
Q1:Apache 設置rewrite時 $_SERVER['SCRIPT_NAME'] 變成RewriteRule 那支程式了
A1:
$_SERVER['SCRIPT_NAME']
换成了
$uri = $_SERVER['REQUEST_URI'];
發生情況: 進入某些站台時,會出現404狀況
查log時會出現 下列類似訊息 2016/09/30 15:40:53 [crit] 22737#0: 1 connect() to unix:/tmp/php-fpm/www.sock failed (2: No such file or directory) while connecting to upstream, client: ......, server: ....., request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm/www.sock:", host: ..... 2016/09/30 15:40:53 [error] 22737#0: 1 open() "/etc/nginx/html/50x.html" failed (2: No such file or directory), client: 10.30.2.47, server: ...., request: "GET / HTTP/1.1", upstream: ...., host: ......
解法: 1.先確認 php-fpm fastcgi socket 路徑 可能會在 /etc/php-fpm.d config檔中 2.確認 nginx 站台config檔中 fastcgi_pass 指定路徑是否正確 3.若不正確,修正為正確路徑後 nginx 重啟
nginx php log會有出現 to unix:/var/lib/php/php.sock failed (11: Resource temporarily unavailable) 這樣的問題
解法: /etc/php-fpm.d config檔中 看連線數
http://xyz.cinc.biz/2015/09/linux-nginx-php-fpm-connection.html https://www.mxp.tw/2015/12/14/nginx-%E6%90%AD%E9%85%8D-php-fpm-%E6%99%82%E8%BD%89%E7%94%A8-unix-tcp-socket-%E6%99%82%E5%87%BA%E7%8F%BE-502-bad-gateway-%E9%8C%AF%E8%AA%A4/ http://www.cppblog.com/wuyaowugang/archive/2012/07/25/185000.html