PHP
  Home arrow PHP arrow Page 2 - Doing More With phpMyAdmin (Part 1)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Doing More With phpMyAdmin (Part 1)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 143
    2003-10-27


    Table of Contents:
  • Doing More With phpMyAdmin (Part 1)
  • Start Me Up
  • Locking the Doors
  • The More the Merrier
  • A Perfect State
  • The Privileged Few
  • In and Out
  • Mood Ring

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Doing More With phpMyAdmin (Part 1) - Start Me Up
    ( Page 2 of 8 )

    In order to get started with phpMyAdmin, you'll need a working PHP installation (I'm currently running PHP 4.2.3), a MySQL database server (I'm running MySQL 4.0.14) and a copy of the latest release (currently version 2.5.3) of the package; you can download a copy from http://www.phpmyadmin.net/

    The developers of phpMyAdmin have been considerate enough to maintain two versions of this popular software, one for servers that have been configured to parse PHP files with the ".php3" extension (a widely observed legacy) and another for those using the newer ".php" extension. You should select the version that is compliant with your Web server's configuration.

    Setting up the package is pretty simple. The first step is to uncompress the source archive into a directory under your Web server (mine is called "medusa" here) root.

    $ cd /usr/local/apache/htdocs/

    $ tar -xzvf /tmp/phpMyAdmin-2.5.3.tar.gz


    This should create a directory named "phpMyAdmin/".

    After checking to make sure that your Web and MySQL servers are up and running (you'd be surprised how often even experienced developers forget to do this at times), you can try accessing the application, by popping open your Web browser and navigating to the URL http://localhost/phpMyAdmin/. Here's what you might see.

    "So, what's that error all about," you ask?

    Simple - the software isn't configured yet. Let's do that next.

    phpMyAdmin is configured via a single configuration file, "config.inc.php" (or "config.inc.php3"), located in the application folder. Open it in your favourite text editor and take a quick look at it. If you read the comments, you'll see that it allows you to configure almost every aspect of the application.

    The first thing you usually need to configure is the $cfg['PmaAbsoluteUri'] variable - this stores the Web server URL to the phpMyAdmin installation directory. Assuming an installation directly under the Web server root, you can set this as follows:

    $cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin/';

    While this will get rid of the error message displayed on the application's opening page, you will still not be able to view databases or tables on the MySQL server (go on, try it and see for yourself). This is because the application does not yet know where to look for the MySQL server, or have access privileges for the same. Move on to the next section of the configuration file, which allows you to define the server configuration variable $cfg['Servers'].

    I'll begin with showing you how to configure phpMyAdmin for a single server. In order to do this, you will need three values: the host name or IP address of the machine hosting the MySQL server, the user name to access the server (note that this is *not* the same as the UNIX user name) and the corresponding password. If the server is running on a non-default port, you'll need that information too.

    If you're running phpMyAdmin as an administrator, you can set the user name to "root", or an equivalent privileged user in MySQL. If, on the other hand, you're configuring a "limited-view" phpMyAdmin, which is to be used only by a specific user, you can use that user's user name and password instead.

    Once you have all this information, make sure that your configuration file contains the following (I'll assume here that the server is "localhost", the user is "root", and the root password is "secret", with the server running on its standard port):

    $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname
    $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
    $cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
    $cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method
    $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
    $cfg['Servers'][$i]['password'] = 'secret'; // MySQL password


    A small note here on the "auth_type" parameter above. I have set this value to "config", which indicates that phpMyAdmin should use the credentials provided in this configuration file to access the database server. Note that this is a potential security hole, as the database server becomes vulnerable if the configuration file falls into the wrong hands. I'll be explaining how to solve this problem shortly.

    Once you've made your changes to the file, save it and try navigating back to http://localhost/phpMyAdmin/ in your browser. This time, if you've configured it correctly, you should be able to see a list of databases on the MySQL server in the drop-down box at the top left corner. Select a database from the list and you'll see a list of tables present in it.

    Cool, huh? This is just the beginning.

     
     
    >>> More PHP Articles          >>> More By Harish Kamath, (c) Melonfire
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT