>

美国虚拟主机资讯

美国虚拟主机,美国主机,国外主机资讯。关于国外的虚拟主机,VPS,独立主机一切信息

Archive for the ‘配置’ Category

php.ini中的常用设置

Friday, October 12th, 2007

服务器中的php.ini设置请参考:php.ini中文注释,这里选择说明一些在虚拟主机中常用的设置。在需要覆盖服务器的设置的文件夹中建立一个php.ini文件,然后加上相应的语句即可。所有需要覆盖设置的文件夹都需要放置php.ini文件

1。禁止php.ini文件被浏览

将下面的语句加入php.ini的最下方

<Files php.ini>
Order allow,deny
Deny from all
</Files> (more…)

php.ini中文注释

Friday, October 12th, 2007

[PHP]
; PHP还是一个不断发展的工具,其功能还在不断地删减
; 而php.ini的设置更改可以反映出相当的变化,
; 在使用新的PHP版本前,研究一下php.ini会有好处的

;;;;;;;;;;;;;;;;;;;
; 关于这个文件 ;
;;;;;;;;;;;;;;;;;;;

; 这个文件控制了PHP许多方面的观点。为了让PHP读取这个文件,它必须被命名为
; ‘php.ini’。PHP 将在这些地方依次查找该文件:当前工作目录;环境变量PHPRC
; 指明的路径;编译时指定的路径。
; 在windows下,编译时的路径是Windows安装目录。
; 在命令行模式下,php.ini的查找路径可以用 -c 参数替代。

; 该文件的语法非常简单。空白字符和用分号’;'开始的行被简单地忽略(就象你可能
; 猜到的一样)。 章节标题(例如 : [Foo])也被简单地忽略,即使将来它们可能
; 有某种的意义。
;
; 指示被指定使用如下语法: (more…)

增加php上传文件的大小

Friday, October 12th, 2007

如何改变php只接受2M以内大小文件的上传?

答:默认的PHP安装,是只允许上传最大为2M的文件。如果您想增加,这可能会涉及到php.ini, .htaccess和脚本本身的设置。这里只以更改php.ini为例说明。
在php.ini需要更改的参数是:

  • file_uploads
  • upload_max_filesize
  • max_input_time
  • memory_limit
  • max_execution_time
  • post_max_size
  • (more…)

如何让主域名指向public_html下的子目录

Friday, September 21st, 2007

编辑public_html目录下的.htaccess文件,加入如下语句.如果public_html下没有.htaccess文件,新建一个即可.

注意:将 yourmaindomain.com修改为你的域名,将subfolder修改为你要指向的public_html下的子目录.最后一行中的index.php修改为你的网站的主页名称.(修改粗体表示的内容,其他内容不要改动)

# www.host114.org
# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

RewriteEngine on
# Change yourdomain.com to be your main domain.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$

# Change ‘subfolder’ to be the folder you will use for your main domain.

RewriteCond %{REQUEST_URI} !^/subfolder/

# Don’t change this line.

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# Change ‘subfolder’ to be the folder you will use for your main domain.

RewriteRule ^(.*)$ /subfolder/$1

# Change yourdomain.com to be your main domain again.

# Change ‘subfolder’ to be the folder you will use for your main domain

# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$

RewriteRule ^(/)?$ subfolder/index.php [L]

.htaccess使用说明

Tuesday, September 11th, 2007

.htaccess可以做大量范围的事情,包括:文件夹密码保护、用户自动重新指向、自定义错误页面、变更你的文件扩展名、屏蔽特定的用户IP地址、只允许特定的IP地址、停止目录表以及使用其他文件作为index文件,等等……

1. Introduction 介绍
文件名 .htaccess 属性 644 (RW-R–R–)
htaccess会影响它所在目录下的所有子目录
注意大多数内容都要求保持在一行之内,不要换行,否则会引起错误

2. Error Documents 错误文档
Official document: ErrorDocument Directive
ErrorDocument code document (more…)