เรือ่ง safe mode กับ คำสั่ง include

คือผม ลอง ตั้งเครื่อง set safe mode
แล้วก็ทำการลองเขียน การ connect php กับ mysql

ขึ้นแรก สร้าง file connect.php

<?
$host=“localhost”;
$user=“root”;
$pass="";
$dbname=“new”;
$con = mysql_connect($host,$user,$pass);
if($con) {echo “finish”;}else{ echo “error”;}
?>

ผมลองเรียกมันตรงๆ connect.php ก็ได้ finish

แล้วก็ อีกอัน index.php ในการเรียก

ผมลอง
<?
include “/home/httpd/vhosts/domain.com/httpdocs/connect.php”;
// $sql=“select * from table”;

?>
และ
<?
include “connect.php”;
// $sql=“select * from table”;

?>

ได้ error เดียวกันเลย

Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 0 is not allowed to access /home/httpd/vhosts/domain.com/httpdocs/connect.php owned by uid 10002 in /home/httpd/vhosts/domain.com/httpdocs/index.php on line 2

Warning: main(/home/httpd/vhosts/domain.com/httpdocs/connect.php): failed to open stream: Inappropriate ioctl for device in /home/httpd/vhosts/domain.com/httpdocs/index.php on line 2

เป็นเครื่องทีใช้ plesk นะครับ linux fedora แต่ ตั้ง safe mode ไว้เลย
ไม่รุ้ว่า safe mode เนี่ยมี ผลถึงกับ เรียก include ในการเรียก file connect mysql
ไม่ได้เลยหรือครับ หรือว่า มันต้องเรียกแบบพิเศษอย่างไรหรือเปล่าครับ

โทษทีครับ เจอ เหตุผลแล้วครับ เผอิญ ผมดันไปสร้าง vi file จาก ssh
ทำให้ owner เป็น root มันเลยใช้ ไม่ได้
แฮะๆๆๆ

When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function.
For example:

-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php
-rw-r–r-- 1 root root 1116 May 26 18:01 /etc/passwd

Running this script.php

<?php
readfile(’/etc/passwd’);
?>

results in this error when safe mode is enabled:

Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not
allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2

However, there may be environments where a strict UID check is not appropriate and a relaxed GID check is sufficient. This is supported by means of the safe_mode_gid switch. Setting it to On performs the relaxed GID checking, setting it to Off (the default) performs UID checking.


้ข้อมูลเ้พิ่มเติม http://th2.php.net/features.safe-mode