We have just had the case of having ftp access to a site on a shared hosting LAMP webspace but needed also the database and mainly the database scheme to setup our own development-system for the app. This is actually very straight forward using the following snippet uploaded and executed on the webserver:
exec( 'mysqldump -h dbXXX.1und1.de -u dboYYY -pZZZ dbYYY > dump.sql', $ret );
This is what you do:
- Find the configuration with the db-credentials in the source of the application and replace
- dbXXX.1und1.de with the hostname,
- dboYYY with the username,
- ZZZ with the password (notice there is NO blank between the option -p and the password!),
- dbYYY with the database you would like to backup.
- Save the snippet as file with extension .php and copy it via ftp to the webspace.
- Find the URL to execute the script.
- If it worked, there should be a new file dump.sql in the same directory, download it, it contains the db-schema and all data.
- Delete both files to wipe your traces.
If it does not work try something like “exec(‘ls -la’);”. If you see the contents of the directory you can use the exec-function and the problem is something else.