發表文章

目前顯示的是 11月, 2016的文章

如何升級CentOS上的C++編譯器版本

最近,在CentOS上編譯一個程式發生編譯器錯誤,編譯器抱怨沒有這個選項"-std=c++11",Google了一下發現是編譯器的版本太舊了。你可以透過"gcc --version"得知你的編譯器環境版本。 # gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO 步驟: 1. 安裝來源 wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo 2. 套件管理資料庫更新 yum upgrade 3. 安裝編譯器相關套件 yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ 4. 啟用編譯環境 scl enable devtoolset-2 bash 5. 確認編譯器版本是否已經更新 # gcc --version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO 參考來源 C++11 on CentOS 6, https://edwards.sdsu.edu/research/c11-on-centos-6/

使用Apache來實現Forward / Reverse Proxy服務

Apache可以設定為Gateway模式,換句話說,可以透過Apache來當做Forward/Reverse Proxy,這個可以運用在要存取防火牆內部的伺服器或是當作伺服器的快取。 應用實例: 透過Apache Gateway模式,來產生web socket中wss服務模式。假設你的web socket沒有憑證,可以直接透過網站主機的https來提供,實作方式就是透過Apache Gateway的方法來完成。 Apache需啟用下列兩個模組 Apache Module mod_proxy mod_proxy_wstunnel 修改http.conf設定檔 ProxyPass "/ws/" "ws://echo.websocket.org/" ProxyPass "/wss/" "ws://echo.websocket.org/" 重新啟動Apache Server就可以 參考資料 Apache Module mod_proxy Apache Module mod_proxy_wstunnel

如何找到php.ini設定檔?

不同的Linux distribution上的PHP環境設定會有所不同,我常常有個困擾,到底要如何找到PHP的設定檔呢? 其實,有個簡單的方法,那就是根據目前系統運行的環境參數來找就可以了,因為,實際上的設定檔位置,可能因為系統管理者的習慣與其他原因會有些不同。 只要登入該主機,然後透過PHP -i 輸出目前的所有設定參數,再grep一下就可以知道了。 php -i | grep "php.ini" 或者想要查詢PHP Extension的位置 php -i | grep "extension_dir"