PHP session_start () and require_once conflict over how to handle

Source: Internet
Author: User
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?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.