最近一个网站从Godaddy的Windows主机切换到了Godaddy的Linux主机,结果Fast Secure Contact Form就报错了,错误差不多是这样

Warning:session_start() [function.session-start]: open(/var/chroot/home/content/04/8260904/tmp/sess_hsradrqf1pme0rn46nscmftbd7, O_RDWR) failed: No such file or directory (2) in /home/content/04/8260904/html/xxxxxx/wp-content/plugins/si-contact-form/si-contact-form.php on line 1431

搜索了一下发现这个错误还挺普遍的,经过实验解决方法如下

原因,这是狗爹的问题,session需要写的路径,也就是那个/tmp目录不存在或者脚本没有可写权限。

解决方式:更改session存储路径

具体步骤

1. 在网站根目录下创建一个sessions文件夹,默认权限是705,我也没去管它。

2. 打开wp-config.php,在开头添加更改session路径的代码:如下

<?php
session_save_path('/home/content/33/4684433/html/sessions');
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, WordPress Language, and ABSPATH. You can find more information
 * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
 * wp-config.php} Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */

注意:/home/content/33/4684433/html/sessions 红字部分替换成自己账户id,具体是什么报错信息里有。

3. 打开/wp-content/plugins/si-contact-form/captcha/securimage.php,同样在开头添加

session_save_path('/home/content/33/4684433/html/sessions');

这样session_start的警告错误就消除了。

3条留言

    1. 战友啊,我的主机也是hostmonster,dns解析速度慢没办法,有时候还会被屏蔽。不过再慢也比狗爹强啊,我用过两个人的狗爹账号,那俩网站大多数情况下不改ip打不开,改了ip也慢的要死,国内访问非常吃力。个人感觉hostgator在国内的访问速度还不错。

评论功能已关闭