我遇到了一个相似的问题(只是使用的是mysql而不是MariaDb,还有Joomla 3.4.1),花费了很长时间才解决,所以我会在这里列出可能的障碍清单:
Make sure php5-curl is installed. Joomla can use a proxy only with CURL as transport layer.
sudo apt-get install php5-curl
I found no use in entering the proxy in the Joomla configuration. The only good it did was that the update connection would not time out but return immediately.
It is not enough to place the environment variables in /etc/apache2/envvars, you also need to use "PassEnv" in /etc/apache2/apache2.conf,
i.e. (taken from https://stackoverflow.com/a/21571588/1967646)
PassEnv http_proxy
Also, I needed to pass both HTTP_PROXY, HTTPS_PROXY as xml-lists were fetched via http and files lateron via https (probably update files from github). Possibly, you need to have these variables in lower case but on the joomla configuration page "PHP information" similarly named variables show up in upper case.
I don't know where this really made any difference, but restarting apache2 as follows seems to be the right way (instead of apache2ctl).
sudo service apache2 restart
我组合了一些杂乱的代码来测试curl和php是否能够一起工作,其中大部分来自
https://stackoverflow.com/a/1477710/1967646。 我只添加了大量的错误报告。 将其放入名为
test.php的文件中,放在Web文件夹的根目录中,并使用您喜欢的浏览器查看。
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$url = 'http://update.joomla.org/core/list.xml';
function get_page($url, $proxy=true) {
if ($url!='') {
$ch = curl_init ();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if ($proxy) {
curl_setopt($ch, CURLOPT_PROXY, '<enter your proxy host here>');
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXYPORT, <enter your proxy port here>);
}
if (! $html = curl_exec($ch)) {
echo '<br>Last CURL error is '.curl_error($ch).'<br>';
} else {
echo '<br>CURL without error.<br>';
}
curl_close($ch);
return $html;
} else {
echo 'Empty URL.';
}
}
echo 'Hello, getting pages via curl:';
$html=get_page($url);
var_dump($html);
echo bin2hex($html);
echo '<br>';
var_dump(get_page($url, false));
echo '<br>done.<br>';
?>
index.php
文件中使用putenv('http_proxy=http://proxy.example.com:8080/');
来设置代理,看看是否可以这样工作。 - VolenD