Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to make archive of drupal database with a php code inside node? Without any scripts. This needs in case you forget your FTP access.

share|improve this question

closed as not a real question by kiamlaluno Sep 9 '12 at 2:26

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Can you make your question a bit clearer? I have no clue what you are trying to do and what your problem is. – googletorp Jun 29 '11 at 8:25
For example: i have a user with id==1, how can i make a copy of site's database using php code inside a node, then download it. In case i've forgot ftp and phpmyadmin logins. – Heihachi Jun 29 '11 at 8:51

There is a module for this, use that instead of custom coding PHP in nodes. Generally you never want to put code in nodes for a lot of reasons:

  • No version control.
  • If you make a syntax error you're in big troubles.
  • very hard to maintain when you need to upgrade a site (API changes).
  • Greater possibility to open your site for security vulnerabilities.
  • ...

Anyways the module backup and migrate will do what you need.

Alternative solution

If you don't have DB password or FTP password and want to create a dump, the simplest thing you can do it to:

  1. get the DB password from Drupal

    global $db_url;
  2. Use the password obtained from Drupal to login to PHPmyadmin or similar
  3. Use the GUI to create the dump.
share|improve this answer
Sorry, but i won't use a module for that task. So you have no idea about this? – Heihachi Jun 29 '11 at 8:57
@Heihachi You can copy/paste the code from the module. But after seeing what's needed you might want to reconsider. Any reason why you don't want to use a module? – googletorp Jun 29 '11 at 9:00
in order to install a module, you need FTP access, which the OP has not. – berkes Jun 29 '11 at 10:16
@Heihachi If you don't have the passwords needed, check my alternative solution. – googletorp Jun 29 '11 at 10:43
I have database password, database name and host adress. But i cant login to phpmyadmin, because i can't find the link – Heihachi Jul 1 '11 at 4:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.