Solution to DiscuzX3 installation failure in Linux

Source: Internet
Author: User
The company used jushita server to build a forum the day before yesterday. The installation process was normal but unavailable. under the company's own linux server, after the installation, there was no problem, so I began to read the discuz source code to find the problem. I found that there was some exception in the data view connection. after the connection, the SQL statement could not be executed normally at/source/clas.

The company uses jushita server

The installation process was normal when I set up the forum the day before yesterday.

But it cannot be used. in the company's own linux server, there will be no problems after installation

So I started readingDiscuzSource code to find the problem

Soon I found that there were some exceptions in data reading the connection. after the connection, the SQL statement could not be executed normally.

Db_driver _ under/source/class/db _MysqlPhp file-85 behavior code:


If ($ pconnect ){
$ Link = @ mysql_pconnect ($ dbhost, $ dbuser, $ dbpw, MYSQL_CLIENT_COMPRESS );
} Else {
$ Link = @ mysql_connect ($ dbhost, $ dbuser, $ dbpw, 1, MYSQL_CLIENT_COMPRESS );
}

The mysql_connect () function uses the fourth and fifth parameters.

After directly deleting these two parameters, you can access the website without loading them all the time.

However, neither style nor JS is loaded

Source code debugging again

In the discuz_application.php file in/source/class/discuz, after loading $ this-> _ init_setting () in row 3

Many default parameters are not loaded successfully.

This method calls the fetch_all method in the/source/class/table table_common_setting.php file.

View the data table common_setting. the configuration in the data table is much less than that after correct installation.

The problem with mysql is that the configuration data is not written to the database during installation.

So before installation, remove the two parameters of mysql_connect.

Reinstall discuz to solve the problem.

For more information, see mysql_connect ()

I still haven't figured out how these two parameters cause connection problems on that server.

Maybe the mysql ini configuration on that server is somewhat different.

ResourceMysql_connect([String $ server [, string $ username [, string $ password [, bool $ new_link [, int $ client_flags])

New_link

If the same parameter is used for the second callMysql_connect ()Will not create a new connection, but will return the opened connection id. ParametersNew_linkChange this behavior and makeMysql_connect ()Always open new connections, even whenMysql_connect ()It was previously called with the same parameters.

Client_flags

Client_flagsParameters can be a combination of the following constants:MYSQL_CLIENT_SSL,MYSQL_CLIENT_COMPRESS,MYSQL_CLIENT_IGNORE_SPACEOrMYSQL_CLIENT_INTERACTIVE. For more information, see MySQL client constants.

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.