赞
踩
由于项目特殊限制,不能从本机直接远程连接到DB ,只能通过一台中间server去访问DB,所以想要从本机直接访问DB需要在中间server上搭建一个phpMyAdmin,然后客户端通过访问phpMyAdmin来查询和修改DB。
具备一定的linux操作系统基础知识。
名称 | 版本 |
OS | RedHat x86_64 |
PHP | 5.5.6 |
httpd | 2.2.26 |
mysql | 5.1.73 |
phpMyAdmin | 4.0.9 |
PHP http://us2.php.net/downloads.php
httpd http://httpd.apache.org/download.cgi
mysql http://dev.mysql.com/downloads/mysql/5.1.html#downloads
要安装httpd首先需要安装好 apr,apr-util等依赖包,这里我就不详细介绍了,这里假设你已经准备好了httpd的依赖包。
我的依赖包安装路径为/usr/local。
下载好httpd-2.2.26.tar.gz
执行
tar xf httpd-2.2.26.tar.gz
cd httpd-2.2.26
./configure --enable-so
make
make install
httpd将会安装到默认路径/usr/local/apache2
进入
cd /usr/local/apache2/bin
执行
apachectl start
apachectl stop
如果不报错表示安装成功
httpd的配置文件
下载 MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar
解压出来有很多rpm包
MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-community-debuginfo-5.1.73-1.rhel5.x86_64.rpm
MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-embedded-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-shared-community-5.1.73-1.rhel5.x86_64.rpm
MySQL-shared-compat-5.1.73-1.rhel5.x86_64.rpm
MySQL-test-community-5.1.73-1.rhel5.x86_64.rpm
执行 tar xf MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar
rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm
rpm -ivh *.rpm
默认会安装到/usr/bin;/usr/lib64/mysql/下面我们不需要配置mysql,只要安装好了就行了。php安装的时候需要用到/usr/lib64/mysql/下面的libmysqlclient.
下载php-5.5.6.tar.gz
执行
tar xf php-5.5.6.tar.gz
cd php-5.5.6.tar
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/ --with-mysqli=/usr/bin/mysql_config --enable-mbstring --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-embedded-mysqli --with-libdir=lib64
make
make install
cp php.ini-development /usr/local/lib/php.ini
PHP默认安装到/usr/local下面
查看版本信息
php -v
查看php配置信息
php-config
配置httpd
vim /usr/local/apache2/conf/httpd.conf
如果没有下面这一段就加上
LoadModule php5_module modules/libphp5.so
修改DocumentRoot
- DocumentRoot "/var/www/html/"
- #
- # This should be changed to whatever you set DocumentRoot to.
- #
- <Directory "/var/www/html/">
- #
- # Possible values for the Options directive are "None", "All",
- # or any combination of:
- # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
- #
- # Note that "MultiViews" must be named *explicitly* --- "Options All"
- # doesn't give it to you.
- #
- # The Options directive is both complicated and important. Please see
- # http://httpd.apache.org/docs/2.2/mod/core.html#options
- # for more information.
- #
- Options Indexes FollowSymLinks
-
- #
- # AllowOverride controls what directives may be placed in .htaccess files.
- # It can be "All", "None", or any combination of the keywords:
- # Options FileInfo AuthConfig Limit
- #
- AllowOverride None
-
- #
- # Controls who can get stuff from this server.
- #
- Order allow,deny
- Allow from all
-
- </Directory>
在配置文件末尾加上
- <IfModule ssl_module>
- SSLRandomSeed startup builtin
- SSLRandomSeed connect builtin
- </IfModule>
-
- <FilesMatch \.php$>
- SetHandler application/x-httpd-php
- </FilesMatch>
- <FilesMatch "\.phps$">
- SetHandler application/x-httpd-php-source
- </FilesMatch>
保存关闭
wq
下载phpMyAdmin-4.0.9-all-languages.zip
执行
unzip phpMyAdmin-4.0.9-all-languages.zip
cp phpMyAdmin-4.0.9-all-languages /var/www/html/phpMyAdmin
cd /var/www/html/phpMyAdmin
cp config.sample.inc.php config.inc.php
修改config.inc.php的内容如下
- $cfg['blowfish_secret'] = 'a8b7c6d';
- /*
- * Servers configuration
- */
- $i = 0;
-
- /*
- * First server
- */
- $i++;
- /* Authentication type */
- $cfg['Servers'][$i]['auth_type'] = 'cookie';
- /* Server parameters */
- $cfg['Servers'][$i]['host'] = '10.123.255.1'; //your host ip
- $cfg['Servers'][$i]['connect_type'] = 'tcp';
- $cfg['Servers'][$i]['compress'] = false;
- /* Select mysql if your server does not have mysqli */
- $cfg['Servers'][$i]['port'] = '3306'; // MySQL port
- $cfg['Servers'][$i]['extension'] = 'mysql';
- $cfg['Servers'][$i]['AllowNoPassword'] = false;
- $cfg['Servers'][$i]['user'] = 'test'; // your mysql user
- $cfg['Servers'][$i]['password'] = 'test'; // use here your password
- $cfg['UploadDir'] = '';
- $cfg['SaveDir'] = '';
做完以上步骤之后所有的程序安装完毕启动你的httpd访问http://yourhost:yourport/phpMyAdmin/index.php就可以看到如下画面
输入mysql的用户名密码可以进入一下画面
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。