The code on my site has been running fine for about 8 months, then all of a sudden today I get this when trying to use and php page that uses sessions to log a user in.
Warning: Unknown(): write failed: No space left on device (28) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
Any help would be greatly appreciated, as I have surfed for 6 hours now on the subject and have had no luck
Paul
杂类问题
有些问题没法归到其它类中,可以在这里找到。
- å¨ Windows ä¸ææ ·å¤ç bz2 åç¼©çææ¡£ï¼
- å¨å½æ°å®ä¹ä¸ï¼åæ°æè¾¹ç & æ¯ä»ä¹ææï¼ä¾å¦ asort()ã
- æä¹å¤ç register_globalsï¼
-
在 Windows 中怎样处理 bz2 压缩的文档?
-
如果没有能处理 bz2 文件的压缩工具,从 Redhat » 下载一个命令行工具(进一步信息见下面)。
如果不喜欢用命令行工具,可以试试免费工具例如 » Stuffit Expander,» UltimateZip,» 7-Zip 或者 » Quick Zip。如果有像 » WinRAR 或者 » Power Archiver 之类的工具,可以很容易用它解压缩 bz2 文件。如果用 Total Commander(前身为 Windows Commander),可以从 » Total Commander 网站免费得到一个 bz2 插件。
来自 Redhat 的 bzip2 命令行工具:
Win2K Sp2 用户下载最新版本 1.0.2,所有其它 Windows 用户应该用版本 1.00。下载后重命名可执行文件为 bzip2.exe。为方便起见将其放到一个在你路径中的目录,例如 C:\Windows,C 表示你安装 Windows 的盘符。
注意:lang 指的是你的语种,x 是想要的格式,例如:pdf。要解压缩 php_manual_lang.x.bz2,按照下面的简单说明进行:
- 打开一个命令行窗口
- 进入存放已下载的 php_manual_lang.x.bz2 的目录
- 调用 bzip2 -d php_manual_lang.x.bz2,将 php_manual_lang.x 释放到同一个目录
在下载了包含很多 html 文件的 php_manual_lang.tar.bz2 的情况下,过程是一样的。唯一区别是得到了一个 php_manual_lang.tar 文件。tar 格式可以被大多数 Windows 下流行的压缩工具所处理,例如 » WinZip。
-
怎么处理 register_globals?
-
有关 register_globals 实现方面的安全性,请阅读使用 register_globals 一章。
推荐使用超全局变量而不要依赖 register_globals。
如果需要在一台关闭了 register_globals 的共享主机上运行一些旧式程序而该程序需要此选项打开时,或者在一些打开了此选项的主机上但想消除安全隐患,那么就需要用 PHP 来模拟出相反的设定。最好先问清楚是否能否在哪里更改 PHP 配置的选项,如果不行,那可以用如下的兼容手段。
Example#1 模拟注册全局变量
本例模拟 register_globals On。如果改变了配置文件中的 variables_order 选项,则考虑对 $superglobals 作出相应的改动。
<?php
// Emulate register_globals on
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
}
?>本例模拟 register_globals Off。要记住此代码应在脚本最开头的地方调用。如果使用了会话机制,则在 session_start() 之后调用。
<?php
// Emulate register_globals off
function unregister_GLOBALS()
{
if (!ini_get('register_globals')) {
return;
}
// Might want to change this perhaps to a nicer error
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die('GLOBALS overwrite attempt detected');
}
// Variables that shouldn't be unset
$noUnset = array('GLOBALS', '_GET',
'_POST', '_COOKIE',
'_REQUEST', '_SERVER',
'_ENV', '_FILES');
$input = array_merge($_GET, $_POST,
$_COOKIE, $_SERVER,
$_ENV, $_FILES,
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ($input as $k => $v) {
if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
unset($GLOBALS[$k]);
}
}
}
unregister_GLOBALS();
?>
杂类问题
18-Feb-2008 03:15
18-Feb-2008 03:14
The code on my site has been running fine for about 8 months, then all of a sudden today I get this when trying to use and php page that uses sessions to log a user in.
Warning: Unknown(): write failed: No space left on device (28) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
Any help would be greatly appreciated, as I have surfed for 6 hours now on the subject and have had no luck
Paul
using .htaccess file to disable register globals (register_globals)
The syntax for setting an option is:
php_value name value
php_flag name on or off
Example:
php_flag register_globals off
php_value arg_separator.output &
The example turns off register_globals and sets the value of arg_separator.output to & which is preferred rather than the default &.
Note: you can also set boolean options with the php_value directive, the string will be converted to boolean before assignment.
you can also use .htaccess to turn magic quotes on or off.
Search php.net and you'll find it
19-Jun-2005 06:34
Considering the comment below. I think there's a way to avoid that "problem":
<?php
//
// $starttime is an example of a variable that we might need to define,
// even before, running the "register_globals OFF" emulator below.
//
list($msec, $sec) = explode(' ', microtime());
$starttime = ((float)$msec + (float)$sec);
//
// If register_globals is ON, ensure no unexpected globals are defined.
// ie. We'll try to emulate a register_globals OFF environment.
//
if( (bool)@ini_get('register_globals') )
{
$superglobals = array($_ENV, $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER);
if( isset($_SESSION) )
{
array_unshift($superglobals, $_SESSION);
}
$knownglobals = array(
//
// Known PHP Reserved globals and superglobals:
//
'_ENV', 'HTTP_ENV_VARS',
'_GET', 'HTTP_GET_VARS',
'_POST', 'HTTP_POST_VARS',
'_COOKIE', 'HTTP_COOKIE_VARS',
'_FILES', 'HTTP_FILES_VARS',
'_SERVER', 'HTTP_SERVER_VARS',
'_SESSION', 'HTTP_SESSION_VARS',
'_REQUEST',
//
// Global variables used by this code snippet:
//
'superglobals',
'knownglobals',
'superglobal',
'global',
'void',
//
// Known global variables defined before this code snippet is reached.
//
'starttime',
);
foreach( $superglobals as $superglobal )
{
foreach( $superglobal as $global => $void )
{
if( !in_array($global, $knownglobals) )
{
unset($GLOBALS[$global]);
}
}
}
}
?>
Note the stuff related to the $_SESSION array depends on whether the PHP session has been started or not. You might want to call session_start() before this point (or set session.auto_start ON).
HTH+ :)
13-Apr-2005 11:22
Regarding simulating register_globals = off, note that it is impossible to adequately prevent $_SESSION variables from being globalised, as the array (and thus the globals) are created on a call to session_start(). You would therefore have to 'undo' this when you start a session as using it at the start of your script will have no effect.
To avoid potential problems, use a prefix that is unique for all session variables (e.g. 'SESS_'), and only access them via the $_SESSION array. The prefix ensures that you don't have a naming clash (and therefore a security risk) with any non-session globals.
19-Feb-2005 03:34
I added many links to software that can at least decompress Bzip2-files here:
http://en.wikipedia.org/wiki/Bzip2
