I am trying to help a friend moving a web-site from one web-hotel to another. The old place is already closed, I have only a flat tar file of what was in it.
The web site contained HTML docs and one could download a little Java application (to be loaded on mobile phone) to send data to the web site.
The mobile Java application sent a string to URL=<HOST>/php/register.php. This php script included another php script (../inc/db_login.php), which connected to a SQL DB using $link=mysql_connect(). Another file, register.php, did the SQL insert for putting the new sent data in the DB.
My question is basicaly, where I should put this 2 PHP files on the new website and what permissions the directories and files should have?
The old web server obviously had a /php and /inc directories. None of these exists on the new webserver. Should I create them? What permission should they have? I guess the reason for having the password in a separate PHP file was security. The /php and /inc directory probably had different permissions.
The new server has directories:
/httpdos/httpsdos/cgi-bin/conf(and some others probably irrelevant)
My questions
Does the file-extension (
.php) mean something to the server: as PHP scripts are "included" in HTML code (between<?...?>, does the server need to look at the file suffix or is it irrelevant? (I understand that the server reacts on the<?...?>, of course)should the public file (
register.phpin my case) be placed in thehttpdocs/directory or does the server (apache I think) reacts on something and fetches it in another directory?Should the PHP script have permission
R-X(read and execute),--X(execute) orR--(read)? From a OS perspective I guess apache is just reading this files, meaning that they should beR--, but this would mean that if PHP service is "stopped" the client would get all the PHP code in his browser(?). I would prefer it being--Xbut as this is neither a binary nor has a#!, I guess it must be--R?If the public PHP script can be placed in another dir (e.g
/phpinstead of/httpdocs) what should/php(and the script) have for permission?. I guess the server has to know about this/phpdirectory (or are there usual defaults?)The PHP script included (
../inc/db_login.php, containing SQL password) should not be under/httpdocsI guess. This means that myregister.phpis including a file which is not under the/httpdocssubtree. Does this work? Does the server need to know?
I understand you may need to know the server configuration. Just assume the default in your answer (and you can tell where it is changed if it is).