PHP session_start () and require_once conflict, how to do?
I was debugging on the BAE platform of Baidu. Want to use BCMS-SDK out a mail effect.
Now there is a problem:
Session_Start (); and require_once ("Bcms.class.php"); two statements, regardless of which, as long as they are written in front, they can run the past and then die in the latter place.
Like what
echo "01";
$accessKey = ";
$secretKey = ";
$queueName = ";
$host = ' bcms.api.duapp.com ';
echo "2";
Require_once ("Bcms.class.php");
echo "4";
Session_Start ();
echo "3";
Output 0124, the program hung at the Session_Start,
But
echo "01";
Session_Start ();
$accessKey = ";
$secretKey = ";
$queueName = ";
$host = ' bcms.api.duapp.com ';
echo "2";
Require_once ("Bcms.class.php");
echo "4";
Output 012, the program is hung at the require_once.
More but, if I write like this:
Require_once ("Bcms.class.php");
Session_Start ();
echo "01";
The code did not error, but when the page opened, will prompt 500 error, the server directly to hang up.
Why, how to solve? PHP Session Baidu? App? Engine require require_once
Share to:
------Solution--------------------
Session_Start (); There is no output in front of you, as for the 500 error you said, you can open the PHP error prompt to know what went wrong.
------Solution--------------------
more ButThe previous code was violated: in Session_Start (); There are echoes in front ... The nature of the error
Ob_start () can be used at the beginning of the program; To avoid
For
more ButThe code that you want at least locally through debugging
If there is no local environment, first check the file name Bcms.class.php is written correctly, especially case, check the existence of files
If it's all right, put out his code.
------Solution--------------------
Equire_once ("Bcms.class.php");
Session_Start ();
echo "01";
Session_Start () cannot have output in front of it.
------Solution--------------------
In
echo "2";
Var_dump (file_exists (' Bcms.class.php '));
Do you have to explain what Bcms.class.php has done?