Ecshop and Ucenter communication failure a very strange problem

Source: Internet
Author: User
Tags constant

First, a good article http://blog.csdn.net/viqecel/article/details/52485774


Note that UC. PHP interface How to debug, (api/uc.php is the role of the Forum and other applications, such as transmitting the user name and other information, to their own system synchronization login, or sync registered members), see the tutorial here. http://blog.csdn.net/viqecel/ article/details/52492081


Ucenter indicates that the communication failed because the function onping () returned a value other than 1 in \uc_server\control\admin\app.php.

In about 132 there is such a sentence

    } else {  
                //echo $url; exit ();  
                echo ' document.getElementById (\ ' Status_ '. $appid. ' \ '). InnerHTML = "<span class=\ ' red\ ' > '. $ this->lang[' App_connent_false ']. ' </span> "; Testlink (); ';  
            }  


We can add the echo $url at the back of the else{; exit (); and find a way to see. What is the URL of his return?

How to look at it. You can use Google Browser, into the background of the UC background application management, click on the keyboard F12, enter the Google debugging mode. Then. Click on the small arrow in the lower left corner, as shown in figure one below, and click on the four words of communication failure. Look at how much he corresponds to the URL.

As shown in figure



Then, the following figure, note the key points in the red box, find the source code in the communication failure or communication success four words below him, that is, the corresponding script inside the URL, right-click, copy the URL, open in the browser. You can return the content we want.






If his return URL is http://www.viq.com/api/uc.php?code=612122.

Open the URL and see what information he is returning. If 404, the file does not exist, so the communication fails. If it is blank, look for api/uc.php this file, put the opening error_reporting (0); Comment out this sentence and see if there is any error in the file. After resolving PHP or SQL errors, remove the error_reporting (0) and the previous comment.

Then, \uc_server\control\admin\app.php the echo of this file $url; exit (); Comment out, reopen the above, right-click on the copy of the URL, see if the return is 1, if the return is 1, then the Application management list, The communication is displayed successfully.

Of course, if you have uc.php this communication interface, and there is a test function in the interface. See the official demo.

function test ($get, $post) {return api_return_succeed;}

---------------------------------------------------------------------------------------------------------------

I find the URL according to the above method, the error message after the visit, the following errors

Notice:use of undefined constant data_dir-assumed ' data_dir ' in D:\phpStudy\WWW\www.xxxxxmall.com\includes\cls_ mysql.php on line 260 warning:file_put_contents (D:/phpstudy/www/www.xxxxxmall.com/data_dir/mysql_query_ 8687db5154d5e169336cc55883a87bbd_2017_07_08.log): Failed to open stream:no such file or directory in D:\phpStudy\WWW\www . xxxxxmall.com\includes\cls_mysql.php on line notice:use of undefined constant data_dir-assumed ' data_dir ' in d:\p hpstudy\www\www.xxxxxmall.com\includes\cls_mysql.php on line 260 warning:file_put_contents (D:/phpStudy/WWW/ Www.xxxxxmall.com/DATA_DIR/mysql_query_8687db5154d5e169336cc55883a87bbd_2017_07_08.log): Failed to open Stream:no Such file or directory in D:\phpStudy\WWW\www.xxxxxmall.com\includes\cls_mysql.php on line notice:use of undefined C Onstant data_dir-assumed ' Data_dir ' in D:\phpStudy\WWW\www.xxxxxmall.com\includes\cls_mysql.php on line 260 Warning:fi Le_put_contents (d:/phpstudy/www/www.xxxxxmall.com/data_dir/mysql_query_8687db5154d5e169336cc55883a87bbd_2017_07_08.log): Failed to open stream:no such file or directory in D:\PHPSTUDY\WWW\WW w.xxxxxmall.com\includes\cls_mysql.php on line notice:use of undefined constant data_dir-assumed ' data_dir ' in D:\ phpstudy\www\www.xxxxxmall.com\includes\cls_mysql.php on line 260 warning:file_put_contents (D:/phpStudy/WWW/ Www.xxxxxmall.com/DATA_DIR/mysql_query_8687db5154d5e169336cc55883a87bbd_2017_07_08.log): Failed to open Stream:no Such file or directory in D:\phpStudy\WWW\www.xxxxxmall.com\includes\cls_mysql.php on line 264 1

and find cls_mysql.php.

  if (defined (' Debug_mode ') && (Debug_mode & 8) = = 8)
        {
            $logfilename = $this->root_path. Data_dir. '/mysql_query_ '. $this->dbhash. '_' . Date (' Y_m_d '). '. log ';
            $str = $sql. "\ n";
            if (php_version >= ' 5.0 ')
            {
                file_put_contents ($logfilename, $str, file_append);
            }
            else
            {
                $fp = @fopen ($logfilename, ' ab+ ');
                if ($fp)
                {
                    fwrite ($fp, $str);
                    Fclose ($FP);}}
        

The Data_dir constants have been defined in the init.php, but there is no definition, no solution

/* Create ECSHOP Object *
/$ecs = new ECS ($db _name, $prefix);
Define (' Data_dir ', $ecs->data_dir ());
Define (' Image_dir ', $ecs->image_dir ());


Finally, in the Data/config, change the Debug_mode to not contain 8.

Define (' Debug_mode ', 7);//Modify Debug mode

2017/7/8 Shenzhen





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.