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?


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).


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.


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.


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

protected by Journeyman Geek Dec 10 '16 at 6:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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