文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>安装phpMYAdmin

安装phpMYAdmin

时间:2006-08-22  来源:nothing9

Installing phpMyAdmin

phpMyAdmin is a great tool for creating and managing databases. As noted I could not find a backported package for it. So, I just downloaded and installed it directly from the phpMyAdmin site.

First we'll create a directory that's out of the way of Debian's package management system in /usr/local. We'll call it php5 since we'll be putting Smarty and ADODB files here as well.

$> mkdir /usr/local/php5

Now we untar phpMyAdmin in this directory (creates /usr/local/php5/phpMyAdmin-2.7.0-pl2), and remove the tar.gz file.

$> cp phpMyAdmin-2.7.0-pl2.tar.gz /usr/local/php5/
$> cd /usr/local/php5/
$> tar -zxvf phpMyAdmin-2.7.0-pl2.tar.gz
$> rm phpMyAdmin-2.7.0-pl2.tar.gz

Note: I opt to leave the version info in the phpMyAdmin directory name so I can easily untar a new version right next it without blowing anything away.

Configuring phpMyAdmin

The sample config file provided is config.default.php. We need to copy it to config.inc.php.

$> cd /usr/local/php5/phpMyAdmin-2.7.0-pl2/
$> cp config.default.php config.inc.php

Now we need to make a couple of changes to config.inc.php. First, let's define the URI we'll be using to access PhpMyAdmin (this is not the path to the phpMyAdmin directory, but rather the alias we will use for it in the Apache config). Find the following line,

$cfg['PmaAbsoluteUri'] = '';

and change it to something like this.

$cfg['http://www.mydomain.com/phpmyadmin'] = '';

Next we need to choose an auth type. The three options are 'config', 'http', and 'cookie'. The 'config' option is the default, and requires you to keep your MySQL password right here in this file, which I don't like. The 'http' option prompts you for the password when you access PhpMyAdmin, but will send the password in clear text, which I also don't like. The 'cookie' option is the best I think, and allows you to define a passphrase with the [blowfish_secret] parameter, which phpMyAdmin will use to encrypt the password in a cookie when you log in. To use the 'cookie' auth type, we need to make two changes. First, find the section of the file that looks like this:

/**
* The 'cookie' auth_type uses blowfish algorithm to encrypt the password. If
* at least one server configuration uses 'cookie' auth_type, enter here a
* passphrase that will be used by blowfish. The maximum length seems to be 46
* characters.
*/
$cfg[''] = '';

You need to change this line ..

$cfg[''] = '';

.. to something like the following. Note that you have to add the "blowfish_secret" part within the brackets (I don't know why). Note also that you will not be prompted for the passphrase you enter here, so feel free to make it a real ugly one.

$cfg['blowfish_secret'] = 'some_passphrase_under_46_characters_long';

Then find this line ..

$cfg['Servers'][$i]['auth_type'] = 'config';

... and change the auth type from 'config' to 'cookie', like so ..

$cfg['Servers'][$i]['auth_type'] = 'cookie';

That's it. Save the file.

Configuring Apache to Display phpMyAdmin

Now we need to tell Apache where phpMyAdmin lives, and also create an Apache alias for the phpMyAdmin directory (so we don't have to remember to type "phpMyAdmin-2.7.0-pl2" into the browser all the time). Also, since I don't want anyone else to even try logging in to phpMyAdmin, I will restrict access to just the IP address of my own workstation. To do all this we just need to add a small section to the file /etc/apache2/sites-available/mydomain.com that we created earlier. Add a section like the following, remebering to change the IP address to something appropriate.

# Provide an alias to phpmyadmin
Alias /phpmyadmin /usr/local/php5/phpMyAdmin-2.7.0-pl2
<Directory /usr/local/php5/phpMyAdmin-2.7.0-pl2>
# Restrict phpmyadmin access to just my worksation
Order Deny,Allow
Deny from all
Allow from 192.168.1.2
</Directory>

Reload Apache, and you should be able to point your browser at www.mydomain.com/phpmyadmin and login as the MySQL root user.

相关阅读 更多 +
排行榜 更多 +
末日枪战精英手机版

末日枪战精英手机版

飞行射击 下载
末日模拟生存最新版

末日模拟生存最新版

飞行射击 下载
末日求生枪战安卓版

末日求生枪战安卓版

飞行射击 下载