Question: How to find the **web root** (www, html\_public, etc) of a hosting to upload files automatically via the PHP ftp\_put() function ?

> 
> The purpose is to propose the installation of a PHP script via a form
>  or the users could send their FTP login.
> 
> 
> Then, with a function PHP would upload and install the script remotely
>  on the server. My complete function works perfectly, however I was
>  unable to determine the web directory of the server.
> 
> 
> 

Thank you in advance for your help.

Kind regards

Answer: 
Have you check [$\_SERVER](http://php.net/manual/en/reserved.variables.server.php) ? 

Try this,

```
echo $_SERVER["DOCUMENT_ROOT"];

```
Not 100% sure what you are trying to do here, but by uploading a file in your webroot with this content:

```
echo dirname(__FILE__);

```

You could receive the full root path on your server.