Pergunta

How can I access files via a url that are placed in /home/uzair/etc/index.php? Even when I run domain (something.com) it shows me data of (/home/uzair/public_html/index.php) this file.

Anyone please help me that how can I access that placed in (/home/uzair/etc/index.php) on my domain (something.com)

  • home
    • uzair
      • etc
        • index.php
      • public_html
        • admin
        • index.php
Foi útil?

Solução

It sounds like you are in something.com which is visible to you on the web so it is located inside of public_html but you want to include a file that is higher up in the file system.

If that is what you are looking to do, use:

include("../etc/index.php");

The .. tells the server that you want to access the files in the next level up.

If you did:

include("../../uzair/etc/index.php");

That would have taken you all the way up to home and from there you would have access to many more files if you wanted to.

Files outside of public_html are protected from being seen on the web. Many people use that feature as a security to their content. If you have a file on there that you want to show contents of though, you have to use the include('file.php'); or include_once('file.php'); or even require_once('file.php') in a public ally visible file. Aka a file you have in public_html has to be the one to call the higher up file. If I am understanding your question right, that is how it is supposed to be done. Let me know if that is answering your question or not:-)

How you can run files not in public_html?

Files outside of public_html are protected from being seen on the web. Many people use that feature as a security to their content. If you have a file on there that you want to show contents of though, you have to use the include('file.php'); or include_once('file.php'); or even require_once('file.php') in a public ally visible file. Aka a file you have in public_html has to be the one to call the higher up file. If I am understanding your question right, that is how it is supposed to be done.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top