03 2010

Solve drupal open_basedir restriction realpath problem

Category: PHPlixiphp @ 2010-09-03 13:40:09

Hi all, I am very fortunate to slove a drupal problem for you concerning the drupal open_base restriction problem, I will speak english to tell you that three points.

Firstly, I will show you the problem on vitual host site tmp/ error.

warning: open_basedir restriction in effect.

Error with file api and open_basedir restriction

warning: realpath() [function.realpath]: open_basedir restriction in effect. File(/var/tmp) is not within the allowed path(s): (/home1/vhost/vh449538:/home1/vhost/vh449538/temp:/tmp/expl:/tmp/check) in /home1/vhost/vh449538/www/drupal/includes/file.inc on line 190.

Second, I have found some discussion on the drupal site. They also have this problem but I think the solution is not great.

I thiink I should not modify the drupal core, Its very complex to upgrade your drupal core and maybe others completely dont know where is the problem.

therefor, We should config our setting File system Tell Drupal where to store uploaded files and how they are accessed.

Perfectly, Administrator  Site configuration the file system

Firstly, the site will alert you the /var/tmp is unavailable and dont has the directory, then please go to the place like below:

Home » Administer » Site configuration

Temporary directory: /var/tmp

A file system path where uploaded files will be stored during previews.

change the value from the absolute path /var/temp  to relative path tmp, but you must confirm your site has the directory and its permission is writeable, chmod is 0777.

Finally, the problem is ok, This is my shared drupal issue. thank you!

标签: , , , , ,


17 2010

解决smarty缓存生成tmp文件

Category: PHPlixiphp @ 2010-06-17 17:47:38

中北大学的服务器构架为IIS+PHP,在打开用smarty生成的网站时,网页显示一片空白,打开templates_c文件时,发现里面只有*.tmp文件。

服务器的配置又屏蔽了错误显示,在网上搜索发现是rename没有权限所致。

找到原因就好办,网上的办法是:找到网站文件夹,右键,属性,安全。设置当前IIS用户有修改权限即可。

可是学校的服务器的又一时难以更改,我就想到了解决问题的另一种方法。

原理

因为smarty写入缓存文件时,是根据模板文件发生变化才会重新编译。所以在保证模板不更改的条件下,我直接把template_c文件下编译好的php文件原封不动的传到服务器上,问题解决。

弊端:模板文件更改后,需要将编译过的文件也重新上传上去。

标签: , , , ,