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

simple5

Registered
Aug 21, 2006
2
0
151
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.
 

simple5

Registered
Aug 21, 2006
2
0
151
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?
 

elliotcooper

Well-Known Member
PartnerNOC
May 18, 2005
56
0
156
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