以下为Linux下的php.ini文件源码,请各位帮忙看看,哪些地方需要改的。谢谢大家。[PHP];;;;;;;;;;; ; WARNING ; ;;;;;;;;;;; ; This is the default settings file for new PHP installations. ; By default, PHP installs itself with a configuration suitable for ; development purposes, and *NOT* for production purposes. ; For several security-oriented considerations that should be taken ; before going online with your site, please consult php.ini-recommended ; and http://php.net/manual/en/security.php. ;;;;;;;;;;;;;;;;;;; ; About this file ; ;;;;;;;;;;;;;;;;;;; ; This file controls many aspects of PHP's behavior. In order for PHP to ; read it, it must be named 'php.ini'. PHP looks for it in the current ; working directory, in the path designated by the environment variable ; PHPRC, and in the path that was defined in compile time (in that order). ; Under Windows, the compile-time path is the Windows directory. The ; path in which the php.ini file is looked for can be overridden using ; the -c argument in command line mode. ; ; The syntax of the file is extremely simple. Whitespace and Lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored, even though ; they might mean something in the future. ; ; Directives are specified using the following syntax: ; directive = value ; Directive names are *case sensitive* - foo=bar is different from FOO=bar. ; ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, False, Yes, No and None) or an expression ; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo"). ; ; Expressions in the INI file are limited to bitwise operators and parentheses: ; | bitwise OR ; & bitwise AND ; ~ bitwise NOT ; ! boolean NOT ; ; Boolean flags can be turned on using the values 1, On, True or Yes. ; They can be turned off using the values 0, Off, False or No. ; ; An empty string can be denoted by simply not writing anything after the equal ; sign, or by using the None keyword: ; ; foo = ; sets foo to an empty string ; foo = none ; sets foo to an empty string ; foo = "none" ; sets foo to the string 'none' ; ; If you use constants in your value, and these constants belong to a ; dynamically loaded extension (either a PHP extension or a Zend extension), ; you may only use these constants *after* the line that loads the extension. ; ; All the values in the php.ini-dist file correspond to the builtin ; defaults (that is, if no php.ini is used, or if you delete these lines, ; the builtin defaults will be identical).
;;;;;;;;;;;;;;;;;;;; ; Language Options ; ;;;;;;;;;;;;;;;;;;;;; Enable the PHP scripting language engine under Apache. engine = On; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized. short_open_tag = On; Allow ASP-style <% %> tags. asp_tags = Off; The number of significant digits displayed in floating point numbers. precision = 14; Enforce year 2000 compliance (will cause problems with non-compliant browsers) y2k_compliance = Off; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (e.g., output_buffering=4096). output_buffering = Off; You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "ob_gzhandler", output will be ; transparently compressed for browsers that support gzip or deflate encoding. ; Setting an output handler automatically turns on output buffering. output_handler =; The unserialize callback function will called (with the undefind class' ; name as parameter), if the unserializer finds an undefined class ; which should be instanciated. ; A warning appears if the specified function is not defined, or if the ; function doesn't include/implement the missing class. ; So only set this entry, if you really want to implement such a ; callback-function. unserialize_callback_func=; Transparent output compression using the zlib library ; Valid values for this option are 'off', 'on', or a specific buffer size ; to be used for compression (default is 4KB) ; ; Note: output_handler must be empty if this is set 'On' !!!! ; zlib.output_compression = Off; Implicit flush tells PHP to tell the output layer to flush itself ; automatically after every output block. This is equivalent to calling the ; PHP function flush() after each and every call to print() or echo() and each ; and every HTML block. Turning this option on has serious performance ; implications and is generally recommended for debugging purposes only. implicit_flush = Off; Whether to enable the ability to force arguments to be passed by reference ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function ; declaration. You're encouraged to try and turn this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by ; reference). allow_call_time_pass_reference = On; Safe Mode ; safe_mode = Off; By default, Safe Mode does a UID compare check when ; opening files. If you want to relax this to a GID compare, ; then turn on safe_mode_gid. safe_mode_gid = Off; When safe_mode is on, UID/GID checks are bypassed when ; including files from this directory and its subdirectories. ; (directory must also be in include_path or full path must ; be used when including) safe_mode_include_dir = ; When safe_mode is on, only executables located in the safe_mode_exec_dir ; will be allowed to be executed via the exec family of functions. safe_mode_exec_dir =; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory ; or per-virtualhost web server configuration file. ; ;open_basedir =; Setting certain environment variables may be a potential security breach. ; This directive contains a comma-delimited list of prefixes. In Safe Mode, ; the user may only alter environment variables whose names begin with the ; prefixes supplied here. By default, users will only be able to set ; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). ; ; Note: If this directive is empty, PHP will let the user modify ANY ; environment variable! safe_mode_allowed_env_vars = PHP_; This directive contains a comma-delimited list of environment variables that ; the end user won't be able to change using putenv(). These variables will be ; protected even if safe_mode_allowed_env_vars is set to allow to change them. safe_mode_protected_env_vars = LD_LIBRARY_PATH; This directive allows you to disable certain functions for security reasons. ; It receives a comma-delimited list of function names. This directive is ; *NOT* affected by whether Safe Mode is turned On or Off. disable_functions =; Colors for Syntax Highlighting mode. Anything that's acceptable in ; <font color="??????"> would work. highlight.string = #CC0000 highlight.comment = #FF9900 highlight.keyword = #006600 highlight.bg = #FFFFFF highlight.default = #0000CC highlight.html = #000000 ; ; Misc ; ; Decides whether PHP may expose the fact that it is installed on the server ; (e.g. by adding its signature to the Web server header). It is no security ; threat in any way, but it makes it possible to determine whether you use PHP ; on your server or not. expose_php = On
再给你个php的配置教程.我就是根据这个配置的.
先从各官方网站下了APACHE2.050、PHP5、MYSQL4.0.20、PHPMYADMIN2.57apache_2.0.50-win32-x86-no_ssl.msi
php-5.0.0-Win32.zip
mysql-4.0.20d-win.zip
phpMyAdmin-2.5.7.zip操作系统 win2003 系统盘为: D盘第一步: 安装apache 并配置支持PHP点击安装文件apache_2.0.50-win32-x86-no_ssl.msi
将apache安装在 D:\apache2 目录(随自己喜好)下
将php-5.0.0-Win32.zip 里内容解压到 D:\php 里
找到 php目录里的 php.ini-dist 重命名为 php.ini 并拷到 windows目录里(win2k 里为winnt)
如我的php.ini是拷到 D:\windows目录
再将php目录里的 php5ts.dll,libmysql.dll 拷到 系统目录(system/system32) 如我的是D:\windows\system里配置apache里的httpd.conf
打开 D:\Apache2\conf\httpd.conf 这个文件
找到 AddDefaultCharset ISO-8859-1 将其改为 AddDefaultCharset GB2312 (让默认语言编码为简体中文)
找到 DocumentRoot "D:/Apache2/htdocs" 将其改为你的WEB目录(可不改)如我的为 DocumentRoot "D:/website"
找到 DirectoryIndex index.html index.html.var 在后面加入 index.htm index.php选择安装模式: 模块化模式安装 或 CGI模式安装 (选一样即可)--------------模块化安装配置------------------------------------
找到 #LoadModule ssl_module modules/mod_ssl.so 这行,在此行后加入一行
LoadModule php5_module d:/php/php5apache2.dll
其中d:/php/php5apache2.dll 为你php目录中php5apache2.dll所在的位置
找到 AddType application/x-gzip .gz .tgz 这行,在此行后加入一行
AddType application/x-httpd-php .php
-----------------------------------------------------------------------------CGI安装配置--------------------------------------
找到 AddType application/x-gzip .gz .tgz 这行,加入如下即可
ScriptAlias /php/ "d:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"
---------------------------------------------------------------此时PHP环境基本已经配置成功
在WEB根目录(如我的D:\website)里建一个名为test.php的文件内容如下
<? echo phpinfo(); ?>
重新启动apache服务
用浏览器打开 http://localhost/test.php
如果可以看到php配置输出信息就OK了第二步 安装mysql将mysql安装到指定目录,如我的是d:/mysql 如下载的是非安装的mysql压缩包,直接解压到指定目录就可以了
然后点击D:\mysql\bin\winmysqladmin.exe这个文件 其中D:\mysql是你的mysql安装目录
输入winmysqladmin的初始用户、密码 (注:这不是mysql里的用户、密码)随便填不必在意
确定之后你的右下角任务的启动栏会出现一个红绿灯的图标,红灯亮代表服务停止,绿灯亮代表服务正常,左击这个图标->winnt->install the service 安装此服务
再左击这个图标->winnt->start the service 启动mysql服务修改mysql数据库的root密码
用cmd进入命今行模式输入如下命令: ( 注: d:\mysql 为mysql安装目录)
cd d:\mysql\bin
mysqladmin -u root -p password 123456
回车出现
Enter password: ( 注:这是叫你输入原密码. 刚安装时密码为空,所以直接回车即可)
此时mysql 中账号 root 的密码 被改为 123456 安装完毕三、配置php.ini并测试mysql(php.ini为 d:\windows下的 php.ini)找到extension_dir = "./" 改为 extension_dir = "d:/php/ext"
找到
;extension=php_mysql.dll
将';'去掉改为
extension=php_mysql.dll
找到
;session.save_path = "/tmp"
将';'去掉 设置你保存session的目录,如
session.save_path = "D:/php/session_temp";重启apache服务
在Web根目录下(如 D:\website)建立testdb.php文件内容如下:
<?php
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "fail";
else echo "success";
mysql_close();
?>
用浏览器打开http://localhost/testdb.php 如果输出success就OK了四、phpmyadmin的安装配置将phpMyAdmin-2.5.7.zip解压到WEB根目录中去,重命名文件夹为phpmyadmin或其它
打开phpmyadmin 目录中的 config.inc.php
找到
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
分别填上你mysql的用户和密码即可如不是本地使用,最好加上验证新
以上各位告诉我的方法都是windows下的。我想请教大家能否提供Linux下的解决方法。
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes, and *NOT* for production purposes.
; For several security-oriented considerations that should be taken
; before going online with your site, please consult php.ini-recommended
; and http://php.net/manual/en/security.php.
;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP's behavior. In order for PHP to
; read it, it must be named 'php.ini'. PHP looks for it in the current
; working directory, in the path designated by the environment variable
; PHPRC, and in the path that was defined in compile time (in that order).
; Under Windows, the compile-time path is the Windows directory. The
; path in which the php.ini file is looked for can be overridden using
; the -c argument in command line mode.
;
; The syntax of the file is extremely simple. Whitespace and Lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.
;
; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
;
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").
;
; Expressions in the INI file are limited to bitwise operators and parentheses:
; | bitwise OR
; & bitwise AND
; ~ bitwise NOT
; ! boolean NOT
;
; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.
;
; An empty string can be denoted by simply not writing anything after the equal
; sign, or by using the None keyword:
;
; foo = ; sets foo to an empty string
; foo = none ; sets foo to an empty string
; foo = "none" ; sets foo to the string 'none'
;
; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the extension.
;
; All the values in the php.ini-dist file correspond to the builtin
; defaults (that is, if no php.ini is used, or if you delete these lines,
; the builtin defaults will be identical).
; Language Options ;
;;;;;;;;;;;;;;;;;;;;; Enable the PHP scripting language engine under Apache.
engine = On; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
short_open_tag = On; Allow ASP-style <% %> tags.
asp_tags = Off; The number of significant digits displayed in floating point numbers.
precision = 14; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
y2k_compliance = Off; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = Off; You can redirect all of the output of your scripts to a function. For
; example, if you set output_handler to "ob_gzhandler", output will be
; transparently compressed for browsers that support gzip or deflate encoding.
; Setting an output handler automatically turns on output buffering.
output_handler =; The unserialize callback function will called (with the undefind class'
; name as parameter), if the unserializer finds an undefined class
; which should be instanciated.
; A warning appears if the specified function is not defined, or if the
; function doesn't include/implement the missing class.
; So only set this entry, if you really want to implement such a
; callback-function.
unserialize_callback_func=; Transparent output compression using the zlib library
; Valid values for this option are 'off', 'on', or a specific buffer size
; to be used for compression (default is 4KB)
;
; Note: output_handler must be empty if this is set 'On' !!!!
;
zlib.output_compression = Off; Implicit flush tells PHP to tell the output layer to flush itself
; automatically after every output block. This is equivalent to calling the
; PHP function flush() after each and every call to print() or echo() and each
; and every HTML block. Turning this option on has serious performance
; implications and is generally recommended for debugging purposes only.
implicit_flush = Off; Whether to enable the ability to force arguments to be passed by reference
; at function call time. This method is deprecated and is likely to be
; unsupported in future versions of PHP/Zend. The encouraged method of
; specifying which arguments should be passed by reference is in the function
; declaration. You're encouraged to try and turn this option Off and make
; sure your scripts work properly with it in order to ensure they will work
; with future versions of the language (you will receive a warning each time
; you use this feature, and the argument will be passed by value instead of by
; reference).
allow_call_time_pass_reference = On; Safe Mode
;
safe_mode = Off; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
safe_mode_gid = Off; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
safe_mode_include_dir = ; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir =; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
;
;open_basedir =; Setting certain environment variables may be a potential security breach.
; This directive contains a comma-delimited list of prefixes. In Safe Mode,
; the user may only alter environment variables whose names begin with the
; prefixes supplied here. By default, users will only be able to set
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
;
; Note: If this directive is empty, PHP will let the user modify ANY
; environment variable!
safe_mode_allowed_env_vars = PHP_; This directive contains a comma-delimited list of environment variables that
; the end user won't be able to change using putenv(). These variables will be
; protected even if safe_mode_allowed_env_vars is set to allow to change them.
safe_mode_protected_env_vars = LD_LIBRARY_PATH; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
disable_functions =; Colors for Syntax Highlighting mode. Anything that's acceptable in
; <font color="??????"> would work.
highlight.string = #CC0000
highlight.comment = #FF9900
highlight.keyword = #006600
highlight.bg = #FFFFFF
highlight.default = #0000CC
highlight.html = #000000
;
; Misc
;
; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
expose_php = On