Code: Select all
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>Code: Select all
sudo a2enmod userdir
sudo service apache2 restart
You could chown it to group www-data and make it group readable rather than world readable.Tarcas wrote:Note that for Apache to serve a file, it will have to be world-readable.
By default your MySQL system has a couple of highly privileged users who can read, write, damage and destroy ALL of your databases. That's usually less than desirable. Do NOT run your MySQL applications using a superuser ID.digitus wrote: And how to manage mysql i would like to do same with DB accounts
Code: Select all
Order deny,allow
Deny from all
allow from 192.168.xxx.xxxCode: Select all
[client]
host = localhost
port = 3306
[foobarapp1]
database = foobar
user = foobar
password = supersecretpasswordhereCode: Select all
<?php
$con = mysql_connect('localhost', 'foobar','supersecretpasswordhere');
if (!$con) {
die($msgid.'001T DB Connection Error: ' . mysql_error());
}
$dbsel = mysql_select_db('foobar', $con);
if (!$dbsel) {
die($msgid.'002T Can\'t use database foobar: ' . mysql_error());
}
?>Code: Select all
my $connect = DBI->connect("DBI:mysql:;mysql_read_default_file=/usr/local/etc/foobar/foobar.cnf;mysql_read_default_group=foobarapp1", undef, undef) or die "something went wrong ($DBI::errstr)";Code: Select all
$msgid = "FOOBAR";
include_once('/usr/local/etc/foobar/foobar.inc.php');I concede, this is true. Either would work. I forgot about that alternative.DougieLawson wrote:You could chown it to group www-data and make it group readable rather than world readable.Tarcas wrote:Note that for Apache to serve a file, it will have to be world-readable.
Code: Select all
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>