IT Knowledge Base

/IT Knowledge Base

Fatal error: Allowed memory size in PHP

In your web based system written in PHP, some pages may display many data or provide upload functions. It may display a blank page after loading for a long time. Then you can use the following codes to display the error: error_reporting(E_ALL); ini_set('display_errors', TRUE); Sometimes the page displays a blank page because the memory limit is reached. And the error [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments

Linux File and Directory Permissions Best Practice

Ownership of Files and Directories When a web application or website is setup, the best practice is to reset file and directory permissions. By default, the owner of the system files are the user who uploaded files to the server. If you are the server manager, you may setup the systems by using root account. [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments

How to log more information in linux

For troubleshooting the problem of your website or web application, logs are one of the important information. In Linux, by default, the logs are stored in /var/log/your_apache_service (e.g. httpd, apache2, etc.). There are mainly two types of logs. access_log The web access information which stores the visitor IP, time, full link, return code by default [...]

By | May 7th, 2014|IT Knowledge Base|0 Comments

Linux Server Security (2)︰只允許User進入自己的Home Directory

假如你的 Server 會建立不同的用戶,你會想限制用戶只能有權限看自己的文檔,普遍做法是每個用戶都有自己的Home Directory,通常是 /home/username/public_html。 這個網頁的步驟簡單而清晰,可以參考 1. 開啟Apache Config File [super_user_name@server ~]$ sudo vi /etc/httpd/conf/httpd.conf   2. 尋找「IfModule mod_userdir」,並修改如下 <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # #UserDir disabled UserDir "enabled *" UserDir [...]

By | January 2nd, 2014|IT Knowledge Base|0 Comments

Linux Server Security (1)︰SSH 限制

當建立了一個新的Server後,首要考慮的是Security的問題,從Rackspace的網站中發現了很好的基本建議,而且有很清晰的步驟。詳情可參看這裡。 以下是參考Rackspace的建議後所作的Summary︰ 1. 用root account SSH [user@pc ~]$ ssh root@your_server_ip 2. 修改root密碼 [root@server ~]$ passwd 3. 新增Super User,避免用root account 新增一個Super User,用戶名稱是super_user_name [root@server ~]$ useradd super_user_name 允許這個Super User 透過 sudo command 進行 administrative 的操作,Run以下command [root@server ~]$ visudo 這會開啟了一個file,加這句到file的末端,然後儲存 super_user_name   ALL=(ALL) ALL 修改Super User的密碼 [root@server ~]$ su super_user_name [super_user_name@server ~]$ passwd 不要關閉現在的SSH視窗,用新視窗測試可否用Super User SSH [user@pc ~]$ ssh super_user_account@your_server_ip 即使登入成功,還不要關閉root的SSH視窗,可以先關閉Super User的SSH視窗   [...]

By | January 2nd, 2014|IT Knowledge Base|0 Comments