The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I add a php file? And then find it?

Discussion in 'General Discussion' started by simple5, Aug 21, 2006.

  1. simple5

    simple5 Registered

    Joined:
    Aug 21, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I am trying to add a php file. The name of the file is links.php. Then how do I direct a web browser to it? Any help would be great.
     
  2. websupport

    websupport Well-Known Member

    Joined:
    Jun 24, 2006
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
  3. simple5

    simple5 Registered

    Joined:
    Aug 21, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    It is not working for me.

    When I do it I get a index of /links.php/assets and no page shows up. Any suggestions?
     
  4. elliotcooper

    elliotcooper Well-Known Member
    PartnerNOC

    Joined:
    May 18, 2005
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    The way that webpages are served is that the URL is broken up into parts. E.g.:

    http://www.domain.com/example-directory/test.php

    It is broken up so that the http:// supplies the server with the sort of protocol you are communicating with it in. The www.domain.com allows the sebserver to know which account you want the webpages for. Finally the last bit allows the webserver to locate the file. The way that this works is that here:

    http://www.domain.com/

    is reffering to the public_html/ directory, i.e.:

    /home/account/public_html/

    So if, as per the example URL you create a directory at:

    /home/account/public_html/example-directory/

    and upload test.php into it the path to the php file is:

    /home/account/public_html/example-directory/test.php

    So first you put the directory you added into public_html on the end of the domain i.e.:

    http://www.domain.com/example-directory/

    Then the file name:

    http://www.domain.com/example-directory/test.php

    So if you check the location of the file on the server you will be able to construct a URL to get there with your browser.

    Also you need to enser that the file has the correct ownership and has the correct permissions. The file has to be owned by and be in the same group as the user. You can set this with the following command:

    chown user.user file.name

    where user is the name of the cpanel account. To set the permissions you need to use the following command:

    chmod 755 file.name
     
Loading...

Share This Page