I get this error showing on every page:

Warning: parse_url(mysql://*****) [function.parse-url]: Unable to parse URL in backup_migrate_destination_remote->set_url() (line 1018 of /home/**/public_html/sites/all/modules/backup_migrate/includes/destinations.inc).

Any help will be greatly appreciated.

Comments

superman2’s picture

I had the same problem. I guess it could not handle my password (which included & and / signs). I changed my password for my database user in mysql and in settings.php, and it was all good afterwards.

Guit4eva’s picture

My password doesn't have any symbols or special characters:/

ecksley’s picture

I am also having this problem. Same passwords I used in Drupal 6 with Backup Migrate.

prston’s picture

Following your bug report, the error comes from parse_url(mysql://*****) which means that the $url passed to the function parse_url($url) is not empty and seems to be valid (mysql://***** in your case).

The problem is the parse_url() function is not provided by Drupal but it is by PHP. After some checks on my PHP 5.3.5 version, the parse_url() function supports some special characters in password like ":" but not some others like the infamous "/".

After some additional researches on PHP, it seems the parse_url() function has some bugs while handling UTF8 encoded url's, and in this case the error handling is not the same depending on which PHP version you are using.

For more information, look out the following comments on PHP.net:
- http://ch.php.net/manual/en/function.parse-url.php#101433
- http://ch.php.net/manual/en/function.parse-url.php#103297

Seems the workaround has to be implemented "ourselves". Since it is apparently a PHP related bug and the bug does not appear in a majority of cases, I don't know if the Backup & Migrate module really has to implement a workaround...

belong@mywebworkshop.com’s picture

Can anyone tell me what the workaround is? I have one website with this problem, and no odd characters in the password (letters, numbers and one hyphen).

joseph11’s picture

I found this warning message in log and I don't have any special characters in password.
BUT I'm using unix_socket to connect to the DB server instead of host.

Does backup and migrate take into account that there might be no host defined in DB connection parameters (but only unix_socket parameter)?

ronan’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)

Are you still having problems with this?

criscom’s picture

Just encountered the same problem. I solved it by changing the password for my database, excluding the special character that I had in there. The character I changed was "/".

ntg’s picture

Hello,
I came across the same issue when the "host" (databases connection array) in the settings.php file was unintentionally left blank. That happened while changing settings in order to point to another database.

Initially I thought that the error was caused by had special characters in my password but it wasn't the case. When I entered a value for the "host" the error disappeared.

I hope this helps.

JKingsnorth’s picture

Status: Postponed (maintainer needs more info) » Active

Can anyone confirm that the issue is solved by making sure that 'host' in settings.php is not blank? If so this should be added as a check into the module.

markdorison’s picture

Version: 7.x-2.2 » 7.x-3.x-dev

I have seen this issue occur when a slash is present in the url password. When calling parse_url() in this case, it fails to parse the url.

bedlam’s picture

Hi Mark :)

It looks like this is not considered a bug in php, however it will work correctly if the password is 'percent-encoded' (i.e. passed through urlencode()):

parse_url is behaving per the spec here, since RFC 3986 doesn't allow
slash characters within the userinfo component of the URL: slashes need
to be percent-encoded to be used.

(RFC3986)

I dunno whether it will be suitable for your application or not, but the following code shows how it can work:

$scheme = 'mysql';
$host = 'domain.tld';
$user = 'user';
$pass = urlencode('pas/sword');

$url = sprintf('%s://%s:%s@%s', $scheme, $user, $pass, $host);

var_dump(parse_url($url));

This outputs:

array (size=4)
  'scheme' => string 'mysql' (length=5)
  'host' => string 'domain.tld' (length=10)
  'user' => string 'user' (length=4)
  'pass' => string 'pas%2Fsword' (length=11)

This makes sense in a situation where you're passing a url to another tool that uses parse_url() on your output. On the other hand, it won't help if you have to parse a url from elsewhere.

couturier’s picture

Status: Active » Closed (outdated)

Please re-open if this is still an issue for anyone.