Php脚本无法在Wamp Localhost上运行,但在远程服务器上运行良好


Php Script not working on Wamp Localhost but working fine on remote server

当我在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。

请尝试以下操作:

  1. 如果使用wamp服务器,请转到php.ini文件
  2. 打开文件并搜索会话.auto_start
  3. 将session.auto_start=0替换为session.auto-start=1
  4. 重新启动服务器

当我在localhost上打开index.php时,页面显示完整或php错误,如(未识别的变量等)

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

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

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

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