Super User is a question and answer site for computer enthusiasts and power users. 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

Is it possible when copying an entire website and template using wget (httrack or other program) to also get the PHP code and the SQL database?

What software would I need to copy/mirror a site like this? And is "Internet Download Manager" a program that is usable for this?

share|improve this question
There is some software that allows you to download an entire website (without the server-side software):… – Anderson Green Oct 14 '12 at 16:19

No. The web server would have to expose these files to you explicitly.

When you load a website that uses PHP/SQL, it will run the PHP on the server itself, and return the output of the PHP program (usually a mix of HTML, CSS, and JS). These files are actually never stored in those states on the web server, but are procedurally generated. What you are doing when using wget is you are downloading the output of the web server (the response to your HTTP queries), not copying files off of the server.

The SQL server is only accessible from a trusted account, and usually is accessed by said PHP code. Unless you have the credentials to log into the server itself using ssh or sftp, you will not be able to gain access to the raw PHP code or SQL database.

The server may be configured to allow direct downloads of files from the computer, including PHP files, but this is not common because it defeats the purpose of employing PHP at all. A competant admin would not allow direct access to the PHP code, and especially would highly restrict access to the SQL server.

That is not to say you can't do this using security exploits. But doing so would generally be immoral unless you have a very good reason to do so (for instance, you are hired by a security firm to do security audits on your clients' websites).

share|improve this answer

No, this is not possible unless the website has serious security holes.

PHP is executed on the web server and is never delivered raw to the client. Rather, the client receives the output from the PHP interpreter after it runs the PHP code.

Similarly, the database backend is not accessible by clients, nor can clients make direct queries against it.

share|improve this answer

Again, no. You'll only get the compiled web pages, not the back-end data held in the database.

You need FTP access to the root of the website, from there you can take a mirror including the back end - but only if the database is included in the website path. If not, you need to ports open to query the database and build a mirror or ask the hoster specifically to give you a copy of the database.

share|improve this answer

The short answer is "No". From the client side, you can only get at content using a web page or wget. The data in the SQL database is abstracted by the app for presentation into your browser. To accomplish a full "backup" of the site you would need access to the server-side content, sqk, php file, etc

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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