Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
superman2 CreditAttribution: superman2 commentedI 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.
Comment #2
Guit4eva CreditAttribution: Guit4eva commentedMy password doesn't have any symbols or special characters:/
Comment #3
ecksley CreditAttribution: ecksley commentedI am also having this problem. Same passwords I used in Drupal 6 with Backup Migrate.
Comment #4
prston CreditAttribution: prston commentedFollowing 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...
Comment #5
belong@mywebworkshop.com CreditAttribution: belong@mywebworkshop.com commentedCan 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).
Comment #6
joseph11 CreditAttribution: joseph11 commentedI 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)?
Comment #7
ronan CreditAttribution: ronan commentedAre you still having problems with this?
Comment #8
criscomJust 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 "/".
Comment #9
ntg CreditAttribution: ntg commentedHello,
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.
Comment #10
JKingsnorth CreditAttribution: JKingsnorth commentedCan 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.
Comment #11
markdorisonI 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.
Comment #12
bedlamHi 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()
):(RFC3986)
I dunno whether it will be suitable for your application or not, but the following code shows how it can work:
This outputs:
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.Comment #13
couturier CreditAttribution: couturier as a volunteer commentedPlease re-open if this is still an issue for anyone.