开发者

mysql_pconnect() has been disabled for security reasons

开发者 https://www.devze.com 2023-02-07 19:53 出处:网络
How I connect to the mysq_pconnect? I have this config: <?php define(开发者_JS百科\'DB_HOST\', \'localhost\');

How I connect to the mysq_pconnect?

I have this config:

<?php
    define(开发者_JS百科'DB_HOST', 'localhost');
    define('DB_USER', 'sampleuser');
    define('DB_PASSWORD', 'samplepassword');
    define('DB_DATABASE', 'sampledatabase');
    $conn=mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD) or die ("Error connecting to " . DB_DATABASE);
    mysql_select_db(DB_DATABASE) or die ("Error: Cannot access " . DB_DATABASE . " database");
?>

Do I have to fix anything to enable the mysql_pconnect()?


Why are you coding this way ? take a look at Doctrine DBAL , now to the point of your question: Some crappy hosts disable this function because lazy programmers often make a mess with persistent connections, leaving them open ad infinitum causing database server errors.


you do not need persistent connections. But the host should turn them off normally, not with disable-function.

The host has got it wrong, conplain!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号