改換成PHP 7後,會發生無法下載excel的問題,將display_error設為on後,變成可以下載,但出現下列的錯誤
將那行break拿掉後就正常了。找了老半天,在這做個紀錄
2017年10月19日 星期四
2017年10月7日 星期六
連接DB時出現Warning: mysql_connect(): [2002] No such file or directory
買了台新的MacBook Pro,重建PHP及MariaDB的環境,沒想到卻是惡夢的開始,最後一直卡在〞Warning: mysql_connect(): [2002] No such file or directory〞的問題,一開始以為是MariaDB有問題,最後才發現是確實是MariaDB,不過主要是因為他本身對於localhost的解析有問題,MacBook Pro最新的MacOS high Serria內建的PHP並沒有設定php.ini,裡頭的pdo_mysql.default_socket設定成mysql.socket的所在位置,我在.my.conf中設定
而在php.ini中設定底下的值
這樣PHP中的mysqli就可以new了,不過使用phpMyadmin的話依然會有問題,直接COPY裡頭的config.sample.inc.php,改成底下
這樣就可以使用了,估計這做法只是work around
參考網址:
Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in
socket=/tmp/mysql.sock
而在php.ini中設定底下的值
pdo_mysql.default_socket=/tmp/mysql.sock
這樣PHP中的mysqli就可以new了,不過使用phpMyadmin的話依然會有問題,直接COPY裡頭的config.sample.inc.php,改成底下
$cfg['Servers'][$i]['host'] = '127.0.0.1';
這樣就可以使用了,估計這做法只是work around
參考網址:
Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in
2017年9月29日 星期五
"Values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead"的處理
在XCode中一直出現"Values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead",參考String Format Specifiers文件中所提使用"lu 或 lx"卻都沒用,後來看到清理iOS工程中的Warnings其中提到
(以上出自清理iOS工程中的Warnings)
這才將這討人厭的warning去除 @@
參考網址:
清理iOS工程中的Warnings
Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
在模拟器和真机上,NSInteger是不同的类型定义:#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
在格式化字符串时,使用'%ld'会在真机中报该警告。解决办法:- use %zd for signed, %tu for unsigned, and %tx for hex.
這才將這討人厭的warning去除 @@
參考網址:
清理iOS工程中的Warnings
2017年9月22日 星期五
更新成XCode 9.0時出現"Conflicting types for 'SecRandomCopyBytes'"
開機後被要求更新XCode APP,想說沒差,結果更新完就出現"Conflicting types for 'SecRandomCopyBytes'",還剛好下午要demo,這下可好,連編譯都Fail,查半天看起來是iOS11後不再支援32Bit,而RNCryptor看起來有相容到10.6,查到Conflicting types error in Xcode 9 #248,看起來可以用底下的code就解決了,不過似乎也是讓他可以compiler
參考網址:
Conflicting types error in Xcode 9 #248
ios11 beta error #17
This method(SecRandomCopyBytes) is wrong in Xcode 9 Beta #244
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, void *bytes) __attribute__((weak_import)); #else extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, uint8_t *bytes) __attribute__((weak_import)); #endif
參考網址:
Conflicting types error in Xcode 9 #248
ios11 beta error #17
This method(SecRandomCopyBytes) is wrong in Xcode 9 Beta #244
2017年7月30日 星期日
IIS上強制設定執行的PHP CGI所使用的php.ini
最近一個在Windows IIS上升級PHP 7的需求,這台server安裝的PHP不知為何,安裝新的PHP上去後,新增FastCGI模組指定新版的PHP,php.ini看起來固定使用同一個,無論怎樣安裝都一樣,像是IIS預設一樣,也不知道之前是怎設定安裝的(謎之音:好像是同一個人裝的)
查找半天,最後決定乾脆直接在設定FastCGI模組時就直接指定啦,如下面兩張圖做法,這樣就可以直接設定php.ini,就可以成功使用了
參考網址:
PHP with WinCache on IIS
查找半天,最後決定乾脆直接在設定FastCGI模組時就直接指定啦,如下面兩張圖做法,這樣就可以直接設定php.ini,就可以成功使用了
參考網址:
PHP with WinCache on IIS
訂閱:
文章 (Atom)


