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

 ̄綄美尐妖づ 提交于 2019-12-24 11:49:58

问题


When I open index.php on localhost - the page showing full or php errors such as (unidentified variable, etc) and the web page is not working at all. However exact same php files works on remote server (Godaddy for example)

the index.php file starts with

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

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

the header.php files starts with:

<?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...

I assume there is a problem with PHP SESSIONS in localhost. I dont know why the same script is not working in localhost. Any help is appreciated.

J.


回答1:


Please try this:

  1. If you use wamp server go php.ini file
  2. Open file and search session.auto_start.
  3. Replace session.auto_start = 0 to session.auto_start = 1.
  4. Restart your server.



回答2:


When I open index.php on localhost - the page showing full or php errors such as (unidentified variable, etc)

your localhost is configured to display all errors or in development mode and your server is in production mode that usually display fatal errors only

and the web page is not working at all. However exact same php files works on remote server (Godaddy for example)

there are many reason it was working on your server but not in your localhost some of them are.. 1. PHP extension that is enabled in your server but not in your localhost. 2. Different PHP version? 3. php.ini settings

try to run phpinfo(); function both in your server and in your localhost.



来源:https://stackoverflow.com/questions/26190818/php-script-not-working-on-wamp-localhost-but-working-fine-on-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!