Revise PHP Configuration From Remote Linux Server
— A Simple Useful Tutorial for Webhosting
(节选)
Definition
Linux: a free Unix-type operating system originally created by Linus Torvalds with the assistance of developers around the world.
SSH: Secure Shell
PHP: Hypertext Preprocessor
Q&A
- Is Linux Interface Graphical User Interface?
No, Linux is like MS-DOS. You need to type in commands to complete operation. - Then, why so many people choose Linux?
Linux is open-source. Besides, it runs fast, stable and saves hard device resources. - How can a computer with Linux OS be a webhosting server?
The common environment is LAMP: Linux + Apache + MySQL + PHP. - What is the hosting service in this tutorial?
DreamHost, or “DH” for short. (Visit my blog willin.org for detail) - Where can I get a LAMP web hosting server?
www.Wiwill.com (for Chinese). - What does “php.ini” do?
This file controls many aspects of PHP’s behavior.
Overview
This term I’ve got a brief understanding of Linux from www.niit.com.cn/students. Coincidently, I have great interests in web developing and my website hosting server is Linux Operating System. So, I have further learned Linux especially remote server technology on webhosting.
DreamHost default setting of maximum allowed size for uploaded files is only 7MB, and I can’t even upload a short video. After learned about Linux, I have tried to revise my PHP configuration. And I made it after trying a lot.
In this tutorial, I use my DH web server as an example. Of course, for almost every Linux web server, it won’t be no use if you follow my instructions step by step.
Notice:
Don’t make change if you don’t know how it behaves.
If your website server is under safe mode, do not make any change and it won’t perform well. If not, don’t run your it in safe mode unless unexpected occasions.
Warning:
If your hosting is in DH, you must know that: DH sharing servers do not accept Debug Mode. In season and out of season, once you make it to Debug Mode, your website will be shut down immediately and your file will be deleted for good.
Topic
- To adapt your own php configuration, we need a SSH account first. If you already have one, skip this step.
Login in DreamHost Web Panel (http://panel.dramhost.com).
Choose “Users – Manage Users”, choose one to edit.
Find “User Account Type” and tick “Shell account – allows SFTP/FTP plus ssh access”.
Save changes. - Download PuTTY (a SSH client software), run PuTTYPortable.exe
(You can find it easily from Google.com)

Type FTP address in “Host Name(or IP address)”
Port use “22” if failure, change it for “21”.
Type in a name or click “Save” directly. - Click “Open”. Type in your Username and Password.
Notice:
No “*” when you typing in your password.
If you login in successfully, you will see the interface showing “login as: ****” like this snapshot.
Else you have to try it again.

- Type in the command: mkdir $HOME/example.com/cgi-bin↙
(Make a new cgi-bin fold under your domain root.)
Notice:
i. Replace example.com of your domain name.
ii. “↙” means Enter.
Same in the below. - Type in: cp /etc/php5/cgi/php.ini $HOME/example.com/cgi-bin/php.ini↙
(Copy your old php.ini to your website category.) - Type in: cat << EOF > $HOME/example.com/cgi-bin/php-wrapper.cgi↙
#!/bin/sh↙
exec /dh/cgi-system/php5.cgi $*↙
EOF↙ - (Adapt CGI configuration. DreamHost uses FastCGI & PHP.)
- Set properties of categories and files (or skip this step and use FTP client such as FlashFTP or CuteFTP to complete it). Type in:
chmod 755 $HOME/example.com/cgi-bin↙
chmod 755 $HOME/example.com/cgi-bin/php-wrapper.cgi↙
chmod 640 $HOME/example.com/cgi-bin/php.ini↙ - Type in: exit↙ and then close the SSH client.
- Create the .htaccess file:
Create a text and save as “.htaccess” with notepad. And upload it to your website root fold. (EditPlus Editor recommended)
The content of “.htaccess” file:
Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi
If there is already one existing, copy and paste it to the top. - Upload php.ini to your website cgi-bin fold and finish the configuration.
也想要建立一个独立博客打造自我品牌吗?
如果你喜欢本文或对我的Willin OR Guy感兴趣,请订阅本博客。如何订阅?
版权声明
作者:长岛冰泪,网址:http://www.willin.org/
原文标题:Additional Learning on website1论文
原文链接:http://www.willin.org/develop/niit/add-onweb1/
(C) 长岛冰泪 版权所有,转载时必须以链接形式注明作者和原始出处及本声明。
哈哈,好熟悉的终端画面!
RSSA圈友来拜访了,支持一下!
@北街
亦是好讨厌的
完全不懂····
@无忧 万恶的专业课程