Difference between revisions of "EWEB2"

From Klaus' wiki
Jump to: navigation, search
Line 40: Line 40:
  
 
Reload the info.php page and observe that you now have a section about MySQL.
 
Reload the info.php page and observe that you now have a section about MySQL.
 +
 +
===Administer MySQL through PHP MyAdmin===
 +
 +
Install phpmyadmin by, as root, issuing this command:
 +
 +
<source lang="bash">
 +
$ yum install phpmyadmin
 +
</source>
 +
 +
Next you have to configure the phpmyadmin a little:
 +
 +
In /etc/http/conf.d/phpmyadmin.conf comment out the <Directory "/usr/share/phpmyadmin"> stanza ending up with something like this:
 +
 +
<source lang="text">
 +
# But allowing phpMyAdmin to anyone other than localhost should be considered
 +
# dangerous unless properly secured by SSL
 +
 +
Alias /phpMyAdmin /usr/share/phpMyAdmin
 +
Alias /phpmyadmin /usr/share/phpMyAdmin
 +
 +
#<Directory /usr/share/phpMyAdmin/>
 +
#  Order Deny,Allow
 +
#  Deny from All
 +
#  Allow from 127.0.0.1
 +
#  Allow from ::1
 +
#</Directory>
 +
</source>
 +
 +
Next we check that the authentication in phpMyAdmin is set to http:
 +
 +
Open /usr/share/phpMyAdmin/config.inc.php and look for the line:
 +
 +
 +
<source lang="text">
 +
$cfg['Servers'][$i]['auth_type']    = 'http';      // Authentication method (config, http or cookie based)?
 +
</source>
 +
 +
if the setting is not http change it.
 +
 +
Restart the httpd.

Revision as of 13:14, 14 January 2014

Install PHP

In order to use PHP in the web server, you have to install PHP.

As root perform:

$ yum install php
$ service httpd restart

The last line is to restart the Apache server loading the newly installed module.

Test the PHP installation

In the web-server root (typical /var/www/html) create a file info.php with this content:

<?php
phpinfo();
?>

Next test that your web-server and PHP is running as expected by entering in your web-browser the IP-address of your virtual server and /info.php like:

10.1.18.104/info.php


Get in contact with MySQL

As root install support for the MySQL database by issuing:

$ yum install php-mysql

Restart the httpd server.

Reload the info.php page and observe that you now have a section about MySQL.

Administer MySQL through PHP MyAdmin

Install phpmyadmin by, as root, issuing this command:

$ yum install phpmyadmin

Next you have to configure the phpmyadmin a little:

In /etc/http/conf.d/phpmyadmin.conf comment out the <Directory "/usr/share/phpmyadmin"> stanza ending up with something like this:

# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
 
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
 
#<Directory /usr/share/phpMyAdmin/>
#   Order Deny,Allow
#   Deny from All
#   Allow from 127.0.0.1
#   Allow from ::1
#</Directory>

Next we check that the authentication in phpMyAdmin is set to http:

Open /usr/share/phpMyAdmin/config.inc.php and look for the line:


$cfg['Servers'][$i]['auth_type']     = 'http';      // Authentication method (config, http or cookie based)?

if the setting is not http change it.

Restart the httpd.