Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Godaddy php会话不工作_Php_.htaccess_Session_Session Variables - Fatal编程技术网

Godaddy php会话不工作

Godaddy php会话不工作,php,.htaccess,session,session-variables,Php,.htaccess,Session,Session Variables,我遇到了一个问题,PHP会话在上传到godaddy(linux)托管环境时返回了错误的值。这在我的wampserver(windows 10)上本地运行完全正常。我只是尝试使用亚伯拉罕的推特库,正如上面提到的,我在本地工作 代码非常简单: 2个文件, index.html: <?php error_reporting( E_ALL ); session_save_path('/home/aureagle/public_html/sgorilla.com/sessions'); sessi

我遇到了一个问题,PHP会话在上传到godaddy(linux)托管环境时返回了错误的值。这在我的wampserver(windows 10)上本地运行完全正常。我只是尝试使用亚伯拉罕的推特库,正如上面提到的,我在本地工作

代码非常简单: 2个文件, index.html:

<?php
error_reporting( E_ALL ); 
session_save_path('/home/aureagle/public_html/sgorilla.com/sessions');
session_start();

echo "<br>" . session_save_path() . "<br>";

require "twitteroauth/autoload.php";

use Abraham\TwitterOAuth\TwitterOAuth;

define('CONSUMER_KEY', 'xxx');
define('CONSUMER_SECRET',     'yyy');
define('OAUTH_CALLBACK', 'http://www.sgorilla.com/report.php');

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);

$request_token = $connection->oauth('oauth/request_token',     array('oauth_callback' => OAUTH_CALLBACK));

$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];

$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));  
?>

和要单击的url:

用户从twitter返回后,会调用report.html:

<?php
error_reporting( E_ALL ); 
session_save_path('/home/aureagle/public_html/sgorilla.com/sessions');
session_start();

var_dump($_SESSION);
echo "<br>";

echo "<br>" . session_save_path() . "<br>";

require "twitteroauth/autoload.php";

use Abraham\TwitterOAuth\TwitterOAuth;

define('CONSUMER_KEY', 'xxxx');
define('CONSUMER_SECRET', 'yyyy');

$request_token = [];
$request_token['oauth_token'] = $_SESSION['oauth_token'];
$request_token['oauth_token_secret'] = $_SESSION['oauth_token_secret'];

if (isset($_REQUEST['oauth_token']) && $request_token['oauth_token'] !==    $_REQUEST['oauth_token']) {
// Abort! Something is wrong.
echo "<br>abort!";
}

要添加更多信息,我检查了会话文件。首先将它们全部删除,刷新index.html,检查会话目录。出现了一个会话,但它的内容是错误的。右变量(我添加了一个作为正确的测试),但auth值不同。困惑。还确认了页面之间的会话id正确,但在第一页上,会话文件的内容不正确。有人知道为什么会发生这种情况吗?我正在进步,但需要举手才能越过终点线!我注意到,当使用session_regenate_id时,我创建了4(4!)个会话。然后我突然想到,也许htaccess太傻了,瞧,wordpress有一个htaccess(共享主机,记住,我们还有其他网站在运行)设置。我创建了一个新的.htaccess文件,其中包含simply RewriteBase/,现在我得到了一个有效会话,但还有一个空会话(0字节)。有人知道htaccess文件中应该包含什么吗?好吧,所以我在wordpress上关闭了主网站(不是加载域)的“漂亮链接”功能。