简体   繁体   English

Elgg白屏:未定义的函数Elgg \\\\ mysql_connect()

[英]Elgg white screen: undefined function Elgg\\mysql_connect()

I have an Elgg website running on Ubuntu 12.04 that abruptly started producing the white screen of death. 我有一个运行在Ubuntu 12.04上的Elgg网站,突然开始出现死亡白屏。 No changes were made to any PHP files, all of which were working just moments before. 没有对任何PHP文件进行任何更改,所有这些文件都在片刻之前可以正常工作。 This is the only error I get in the apache error.log : 这是我在apache error.log遇到的唯一错误:

[Thu Jul 23 09:45:49.672038 2015] [:error] [pid 6905] [client 127.0.0.1:53280] PHP Fatal error:  Call to undefined function Elgg\\mysql_connect() in /var/www/my-website/engine/classes/Elgg/Database.php on line 144

Apache2 can load HTML and PHP pages and I can log into MySQL from the command line. Apache2可以加载HTML和PHP页面,我可以从命令行登录MySQL。 I've restarted apache2 and mysql . 我已经重新启动了apache2mysql PHP, AFAIK, is at the most recent version. 最新版本的PHP是AFAIK。 I have restarted my computer and installed the most recent updates. 我已经重新启动计算机并安装了最新更新。 The following test page produces nothing that seems out of the ordinary to the untrained eye: 以下测试页不会产生任何未经训练的人与众不同的东西:

<?php
echo "Test!";
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

phpinfo(); 
exit(); 

?>

This post makes me think that maybe an update ran and broke the PHP / mysql connection, but I can't confirm that. 这篇文章使我认为也许是更新运行并中断了PHP / mysql连接,但我无法确认。 Simpy put, I'm stumped. Simpy放了,我很困惑。 Given that the error is undefined function Elgg\\\\mysql_connect() , I presume something's gone awry at a configuration level, but I have no idea how to fix it nor any firm hypotheses as to what might've caused it. 鉴于该错误是undefined function Elgg\\\\mysql_connect() ,我认为某些错误在配置级别出现了问题,但是我不知道如何解决它,也不清楚任何可能的原因。 What should I try next? 接下来我应该尝试什么?

It is most likely a namespacing issue. 这很可能是命名空间问题。 PHP is assuming that its own native mysql api is a function declared inside the Elgg\\ namespace. PHP假设自己的本地mysql API是在Elgg\\命名空间内声明的函数。 So, go to 'Database.php' and on line 144 change: 因此,转到'Database.php'并在第144行进行更改:

mysql_connect(); to \\mysql_connect(); \\mysql_connect();

The \\ backslash will instruct php this function exists outside the Elgg\\ namespace, or within the global scope. \\反斜杠将指示php此函数存在于Elgg\\名称空间之外或全局范围内。

You'll probably encounter similar issues which you must solve using the same method as described above. 您可能会遇到类似的问题,必须使用如上所述的相同方法来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM