Need help with Linux & PHP permissions

ساخت وبلاگ

Hi all,

I learnt PHP 5.6 using Windows 10 & WAMPServer (64 bit) and recently moved to Ubuntu Linux. I am trying to setup my Linux machine to continue learning PHP. My setup is:

Ubuntu Linux 16.04.1 (64 bit)
Firefox: 48.0
Apache: Apache/2.4.18 (Ubuntu)
MySQL: 5.7.13
PHP: 7.0.8

I have some questions and I have them below in BLUE.

Issue 1: apache2 & mysql start automatically when I turn on my laptop; I prefer to start apache2 & mysql service when I need them. How do I ensure these services don't start automatically on startup?

Issue 2:
My work folder is: /eBooks/PHP/Chapxx and my PHP server folder is: /var/www/html/php/chapxx/

For the PHP server folder /var/www/html, owner is www-data and group is www-data; all sub-folders & files under html have owner as www-data and group as www-data. For permissions, I started off with 'rwxrwxrwx'. For these permissions, I found I could access my PHP files using my browser (http://localhost/php/chapxx/filename.php). Since this is bad practice, through trial & error, I realized I could restrict permissions to 'r-xrwx---' and yet access the PHP file. Currently,

Code:

$pwd
/var/www/html
$ls -l
dr-xrwx--- 3 www-data www-data 4096 Aug 30 23:45 php
Is this the right way to setup PHP server folder(s)? While this seems to work fine, can the setup be improved upon (permissions wise)?

Issue 3.
When I copied some more files from my work folder to PHP server folder, files were copied as:

Code:

-rw-r--r-- 1 la.khan la.khan 1143 Aug 31 07:36 PHP Test for accessing constants and static variables.php
-rw-r--r-- 1 la.khan la.khan 2397 Aug 31 07:41 PHP Use inheritance to create shape classes.php
These files were created using Windows 10 & WAMPServer and hence the long names A couple of things - file copied with my username and group; secondly, file has different permissions. When I accessed the files, the browser loaded them fine; I expected to see error '403 permission denied'. Permissions wise, user wise, group wise, these files shouldn't load in a browser, but they do; any idea why? Permissions wise, which is better 'r-xrwx---' vs. 'rw-r--r--'?

Issue 4.
Just as a test, using my Firefox browser (v.48), I accessed URL http://localhost/php/Chapxx/filename.php (with upper case C), I see a '404 file not found' error. I do know that Linux is case sensitive and can't find Chapxx folder. However, in the real world, URL case is ignored (browsers ignore URL case and web servers ignore URL case). As long as the path is correct, filename exists and file extension is correct, the page is sent back to browser. So, how is my Linux/PHP setup different from application web servers on the internet? Is there a setting where I can instruct Linux to ignore case for all sub-folders of /var/www/html/? Or, use regular expressions to convert URLs to correct case?

Any Idea/insights/pointers to articles/web sites/blogs welcome.

Thanks in advance for your effort & time!

feed all...
ما را در سایت feed all دنبال می کنید

برچسب : need help with linux, نویسنده : استخدام کار feedoll بازدید : 390 تاريخ : چهارشنبه 10 شهريور 1395 ساعت: 15:18