【问题标题】:Php Script not working on Wamp Localhost but working fine on remote serverPhp 脚本无法在 Wamp 本地主机上运行,​​但在远程服务器上运行良好
【发布时间】:2014-11-29 05:06:20
【问题描述】:

当我在 localhost 上打开 index.php 时 - 页面显示完整或 php 错误,例如 (未识别的变量等) 并且网页根本无法运行.然而完全相同的 php 文件在远程服务器上工作(例如 Godaddy)

index.php 文件以

开头
<?
require_once ('templates/header.php');
?>
<div class='grid_12'>
<table>

<div id="form" > and son on....

header.php 文件以:

开头
<?php
session_start();
include('classes/secure.class.php'); // include the class
$secure = new secure(); // load the class
$secure->secureGlobals(); // run the main class function

require_once ('config.php');
require_once ('functions.php');
require_once ('templates/commonheader.php');
require_once ('lang.php');

header('Content-type: text/html; charset=$charset');

?> and so on...

我认为 localhost 中的 PHP SESSIONS 存在问题。我不知道为什么相同的脚本在 localhost 中不起作用。任何帮助表示赞赏。

J.

【问题讨论】:

  • 我认为你的服务器是开发环境并显示所有警告或错误,而你的本地主机没有显示

标签: php session localhost wamp


【解决方案1】:

请试试这个:

  1. 如果你使用 wamp 服务器去 php.ini 文件
  2. 打开文件并搜索 session.auto_start。
  3. 将 session.auto_start = 0 替换为 session.auto_start = 1。
  4. 重新启动服务器。

【讨论】:

    【解决方案2】:

    当我在本地主机上打开 index.php - 页面显示完整或 php 错误,例如(未识别的变量等)

    您的本地主机配置为显示所有错误或处于开发模式,而您的服务器处于通常仅显示致命错误的生产模式

    而且网页根本不工作。然而完全相同的 php 文件在远程服务器上工作(例如 Godaddy)

    它在您的服务器上运行但在您的本地主机上运行的原因有很多 他们之中有一些是.. 1. 在您的服务器中启用但在您的本地主机中未启用的 PHP 扩展。 2. PHP版本不同? 3. php.ini设置

    尝试运行 phpinfo();在您的服务器和本地主机中都可以运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-08
      • 2020-02-25
      • 2020-04-10
      • 2017-07-22
      • 1970-01-01
      • 2011-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多