PHPMyAdmin
LAMP eshte akronim i Linux, Apache, MySQL dhe PHP.
phpMyAdmin eshte nje aplikacion LAMP i ndertuar enkas per administrimin e serverave MySQL . Eshte i shkruajtur ne PHP dhe hapet nepermejt nje web browser. phpMyAdmin ofron nje nderfaqe grafike per kryerjen e veprimeve administrative te MySQL.
Per te instaluar phpmyadmin
sudo apt-get install phpmyadmin
Gjate procesit te instalimit do te na kerkohet te perzgjedhim cilin web server do te perdorim midis appache dhe nje lighweight serveri.
Do te perzgjedhim appache.
Gjate procesit te instalimit phpMyAdmin do te krijoje nje user dhe nje database ne MySQL per administrimin e vete phpMyAadmin. Per kete arsye do te na kerkoje qe te japim kredencialet e perdoruesit qe eshte administrator i MySQL. Si default nese nuk e kemi ndryshuar keto kredenciale jane username: root dhe fjalekalim {bosh}. Ne instalimin shembull tonin kemi vendosur fjalekalimin root per perdoruesin root.
Skedaret e konfigurimit te phpMyAdmin krijohen ne /etc/phpmyadmin
Skedari kryesor i konfigurimit eshte config.inc.php
student@ubuntu:/etc/phpmyadmin$ cat config.inc.php
<?php
/**
* Debian local configuration file
*
* This file overrides the settings made by phpMyAdmin interactive setup
* utility.
*
* For example configuration see
* /usr/share/doc/phpmyadmin/examples/config.sample.inc.php
* or
* /usr/share/doc/phpmyadmin/examples/config.manyhosts.inc.php
*
* NOTE: do not add security sensitive data to this file (like passwords)
* unless you really know what you're doing. If you do, any user that can
* run PHP or CGI on your webserver will be able to read them. If you still
* want to do this, make sure to properly secure the access to this file
* (also on the filesystem level).
*/
// Load secret generated on postinst
include('/var/lib/phpmyadmin/blowfish_secret.inc.php');
// Load autoconf local config
include('/var/lib/phpmyadmin/config.inc.php');
/**
* Server(s) configuration
*/
$i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].
// You can disable a server config entry by setting host to ''.
$i++;
/**
* Read configuration from dbconfig-common
* You can regenerate it using: dpkg-reconfigure -plow phpmyadmin
*/
if (is_readable('/etc/phpmyadmin/config-db.php')) {
require('/etc/phpmyadmin/config-db.php');
} else {
error_log('phpmyadmin: Failed to load /etc/phpmyadmin/config-db.php.'
. ' Check group www-data has read access.');
}
/* Configure according to dbconfig-common if enabled */
if (!empty($dbname)) {
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
if (empty($dbserver)) $dbserver = 'localhost';
$cfg['Servers'][$i]['host'] = $dbserver;
if (!empty($dbport) || $dbserver != 'localhost') {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = $dbport;
}
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser;
$cfg['Servers'][$i]['controlpass'] = $dbpass;
/* Optional: Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = $dbname;
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/* Advance to next server for rest of config */
$i++;
}
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
//$cfg['Servers'][$i]['extension'] = 'mysql';
/* Optional: User for advanced features */
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Optional: Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
student@ubuntu:/etc/phpmyadmin$
Deri ne kete hap kemi instaluar phoMyAdmin por eshte e nevojshme qe ta vendosim ate ne nje site te ri.
DocumentRoot i skedareve te site te phpmyadmin eshte /usr/share/phpmyadmin
Nese vendosim kete DocumentRoot tek site default ne /etc/apache2/sites-available/default
atehere mund ta hapim phpmyadmin nga http://<ip-e-serverit>.
Te krijojme nje site per phpmyadmin.
Shembulli me poshte do te modifikoje aliasin per ict.local nga *.ict.local ne www.ict.local dhe do te vendose db.ict.local ne nje site tjeter per te linkuar tek phpmyadmin.
Se pari do te krijojme nje alias ne DNS per db.ict.local. Me poshte eshte permbajtja e skedarit te zones dns pas modifikimit
student@ubuntu:/etc/bind$ cat db.ict.local
$TTL 86400
@ IN SOA voyager.ict.local. admin.ict.local. (
1 ; Serial Number
3h ; Refresh after 3 hours
1h ; Retry after 1 hour
1w ; Expire after 1 week
1h ) ; Negative caching TTL of 1 hour
@ IN A 192.168.1.104
; Name Servers defined here
ict.local. IN NS voyager.ict.local.
; Mail Exchange servers defined here
ict.local. IN MX 10 voyager.ict.local.
ict.local. IN MX 10 mail.ict.local.
; Host Addresses Defined Here
voyager.ict.local. IN A 192.168.1.104
mail.ict.local. IN A 192.168.1.104
; Aliases
www.ict.local. IN CNAME voyager.ict.local.
email.ict.local. IN CNAME voyager.ict.local.
db.ict.local. IN CNAME voyager.ict.local.
student@ubuntu:/etc/bind$
Eshte shtuar rekordi db.ict.local. IN CNAME voyager.ict.local.
Do ti bejme nje restart serverit DNS qe te aplikohet ky ndryshim ne skedarin e zones:
student@ubuntu:/etc/bind$ sudo service bind9 restart
[sudo] password for student:
* Stopping domain name service... bind9 waiting for pid 9653 to die
[ OK ]
* Starting domain name service... bind9 [ OK ]
student@ubuntu:/etc/bind$
Me poshte eshte permbatja e skedarit ict te modifikuar tek /ect/appache2/sites-available
student@ubuntu:/etc/apache2/sites-available$ cat ict
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName ict.local
ServerAlias www.ict.local
DocumentRoot /var/www/ict/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/ict/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
student@ubuntu:/etc/apache2/sites-available$
Ne skedarin me siper vihet re qe eshte modifikuar ServerAlias i cili me pare ishte *.ict.local tani eshte www.ict.local
Tani po ndertojme nje skedar site me emrin phphmyadmin per te krijuar nje virtual host. Me poshte eshte permabajta e skedarit phpmyadmin
student@ubuntu:/etc/apache2/sites-available$ cat phpmyadmin
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName ict.local
ServerAlias db.ict.local
DocumentRoot /usr/share/phpmyadmin/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /usr/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
student@ubuntu:/etc/apache2/sites-available$
Vini re parametrat e konfigurimit ne fillim te skedarit:
ServerName ict.local
ServerAlias db.ict.local
DocumentRoot /usr/share/phpmyadmin/
Te aktivizojme siten phpmyadmin
student@ubuntu:/etc/apache2/sites-available$ sudo a2ensite phpmyadmin
Enabling site phpmyadmin.
To activate the new configuration, you need to run:
service apache2 reload
student@ubuntu:/etc/apache2/sites-available$ sudo service apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
student@ubuntu:/etc/apache2/sites-available$
Tani nese ne nje kompjuter cfaredo vendosim si DNS IP e serverit tone (192.168.1.104) ne kete shembull, duke qene se ne leksionet e meparshme (5 -DNS) i kam vendosur kete IP severit.
Ne adresen http://db.ict.local do te me hapet aplikacioni phpmyadmin, ne te cilin do te logohem me kredencialet e administratorit te aplikimit qe perzgjodhem ne momentin e instalimit (root/root).