Jump to content

error after installation


Recommended Posts

Hi, I've just installed prestashop and when open my shop I get the following message:

Notice: Use of undefined constant PHP_URL_HOST - assumed 'PHP_URL_HOST' in /var/www/vhosts/lovers-box.com/httpdocs/classes/Connection.php on line 85

Warning: parse_url() expects exactly 1 parameter, 2 given in /var/www/vhosts/lovers-box.com/httpdocs/classes/Connection.php on line 85

Any help???

Thanks,

Javi

Link to comment
Share on other sites

Sounds like you have a version earlier than 5.1.2 of PHP installed:

http://www.php.net/parse_url

5.1.2 Added the component parameter

So the problem is that before 5.1.2, this function returned an array of the parsed URL instead of allowing the caller to grab a single value (in this case the host).

You can work around this by creating a custom function that does the same thing and changing all references to this function where PHP_URL_HOST is passed.

function my_parse_url_host($url)
{
$a=parse_url($url);
if(isset($a['host']))
{
return $a['host'];
}
else
{
return '';
}
}

Affected files look like these:

./classes/ConnectionsSource.php
./classes/Connection.php
./modules/pagesnotfound/pagesnotfound.php
./modules/statsorigin/statsorigin.php
./modules/statslive/statslive.php
./admin/tabs/AdminCustomers.php
./admin/tabs/AdminOrders.php

So you would replace things like:

parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST))

with

my_parse_url_host($_SERVER['HTTP_REFERER'])

Cheers

Link to comment
Share on other sites

×
×
  • Create New...