中国网管论坛's Archiver

2689178 发表于 2007-4-24 21:59

mysql5.0+php5.0+apache5.0安装成功后的连接问题

三个服务全都编译安装成功了
顺序是apache mysql php
下了个Discuz5.5 安装的时候说没有mysql,mysql服务已经启动了
想起来当时编译apache和php的时候都没有加参数--with-mysql=/usr/local/mysql
是不是因为这个原因造成的不能连接上 我能再不重新安装的情况下补救么??

iamshiyu 发表于 2007-4-25 11:44

这种问题说不清楚,指不定哪一步有问题才导致的。不过我想你后面装的哪个软件应该有说明吧,里面应该有针对没有安装在特定位置的mysql的问题解决方案吧。

2689178 发表于 2007-4-26 11:58

查到PHP有一种二次编译的方法,用的是api. 方法是:
cd /root/php5.2/ext/mysql   进入源文件
/usr/local/php/bin/phpize      
./configure --with-mysql=mysql路径 --with-php-config=php-config=路径
make
make install

网上提到过这种方法,可是提到很少,我也没弄成功,编译过程中出现了一处错误,英文不好没看懂。最后选择的重装。可是觉的这个方法可行,将来添模块方便。能不能详细解释一下这个可以么??

日出东方 发表于 2007-4-26 23:48

MySQL安装

     shell> groupadd mysql

     shell> useradd -g mysql mysql

     shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -

     shell> cd mysql-VERSION

     shell> ./configure --prefix=/usr/local/mysql

     shell> make

     shell> make install

     shell> cp support-files/my-medium.cnf /etc/my.cnf (复制配置文件)

     shell> cd /usr/local/mysql

     shell> bin/mysql_install_db --user=mysql (初始化数据库)

     shell> chown -R root  .

     shell> chown -R mysql var

     shell> chgrp -R mysql .

     shell> bin/mysqld_safe --user=mysql &




#Build OpenSSL (In openssl-0.9.x directory)  ([url=http://www.openssl.org/]http://www.openssl.org/[/url])

#./config --prefix=/usr/local/ssl

#make

#make install

Apache 安装

     $ ./configure --prefix=/usr/local/apache2  --with-mysql=/usr/local/mysql --enable-ssl --with-ssl=/usr/local/ssl  如是没有装ssl后面--enable-ssl --with-ssl=/usr/local/ssl不用加

     --enable-rewrite=shared(实现地址重写的模块) --enable-speling=shared(大小写忽略模块) --enable-module=so (so模块是用来提DSO支持的apache核心模块)#对原文件的描述



     $ make

     $ make install

     $ PREFIX/bin/apachectl start =/usr/local/apache2/bin/httpd -k start





#Build CURL (In curl-7.x.x directory)  ([url=http://curl.haxx.se/]http://curl.haxx.se/[/url])

#./configure --prefix=/usr/local/curl --with-ssl=/usr/local/ssl (if ssl was installed here)

#make

#make install (libcurl.so is now in /usr/local/lib)



Build PHP (In php-5.x.x directory)

./configure --prefix=/usr/local/php --with-openssl=/usr/local/ssl  --with-curl=/usr/local/curl/lib --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql

make

make install



cp php.ini-dist /usr/local/lib/php.ini


If we want to start up our Apache2 with SSL support we have to generate the file /usr/local/apache2/conf/ssl.crt/server.crt because otherwise we will get an error message when we start Apache2.

#mkdir /usr/local/apache2/conf/ssl.crt
#openssl genrsa -des3 -passout pass:asecretpassword -out /usr/local/apache2/conf/ssl.crt/server.key.o
#openssl req -new -passin pass:asecretpassword -passout pass:asecretpassword -key /usr/local/apache#2/conf/ssl.crt/server.key.org -out /usr/local/apache2/conf/ssl.crt/server.csr -days 3650
#openssl req -x509 -passin pass:asecretpassword -passout pass:asecretpassword -key /usr/local/apach#e2/conf/ssl.crt/server.key.org -in /usr/local/apache2/conf/ssl.crt/server.csr -out /usr/local/apache2/con#f/ssl.crt/server.crt -days 3650
#openssl rsa -passin pass:asecretpassword -in /usr/local/apache2/conf/ssl.crt/server.key.org -out /usr/l#ocal/apache2/conf/ssl.crt/server.key
#mkdir /usr/local/apache2/conf/ssl.key
#mv /usr/local/apache2/conf/ssl.crt/server.key /usr/local/apache2/conf/ssl.key/server.key
#chmod 400 /usr/local/apache2/conf/ssl.key/server.key


/usr/local/apache2/conf 下编辑httpd.conf文件   

For PHP 4:  LoadModule php4_module modules/libphp4.so

For PHP 5:  LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php .phtm

AddType application/x-httpd-php-source .phps
#Include conf/extra/httpd-ssl.conf 去掉前面的#

#/usr/local/apache2/conf/extra 下编辑httpd-ssl.conf
将DocumentRoot设成与httpd.conf中的DocumentRoot一致
#SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt (修改了证书的路径)
#SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key (修改了证书的路径)


在/etc/rc.local中加入
/usr/local/mysql/share/mysql/mysql.server start
/usr/local/apache2/bin/httpd -k start

开机自动运行

可能要重启电脑

以上是我在安装时的方法可做参考,#部分是你不装这个些模块不去理会的,测试mysql装好没有可以用mysql客户边连接服务端看正常不一般都么认有mysql ,test两个数据库
测试apache有没有装好可以启动apache服务输入[url=http://ip]http://ip[/url]看反回的面页是正常一般都是"it work !",测式你的apache是否支持php在httpd.conf里apache的访页面加下index.php再用[url=http://ip/index.php]http://ip/index.php[/url]如果反回一个关于php介绍的页面表示正常或自已写一个php页面
致于你的DZ的安装还是看下他的安装方法

[[i] 本帖最后由 日出东方 于 2007-4-26 23:56 编辑 [/i]]

iamshiyu 发表于 2007-4-27 09:29

想玩好linux,英语怎么也要马马虎虎才行……不然困难死了。

sunny8924 发表于 2008-5-17 15:49

4楼好强啊

页: [1]

Powered by Discuz! Archiver 6.1.0  © 1999-2008 bbs.bitsCN.com