问题
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:
- If you use wamp server go php.ini file
- Open file and search session.auto_start.
- Replace session.auto_start = 0 to session.auto_start = 1.
- 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