[root@www ~]# useradd -M -s /sbin/nologin mysql
|
[root@www mnt]# tar zxf mysql- 5.0.56 .tar.gz -C /usr/src/
[root@www mnt]# cd /usr/src/mysql- 5.0.56 /
[root@www mysql- 5.0.56 ]#
|
[root@www mysql- 5.0.56 ]# ./configure --prefix=/usr/local/mysql
|
[root@www mysql- 5.0.56 ]# make ; install
|
[root@www mysql- 5.0.56 ]# cp support-files/my-medium.cnf /etc/my.cnf
|
[root@www mysql- 5.0.56 ]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@www mysql- 5.0.56 ]# chown -R root.mysql /usr/local/mysql/
[root@www mysql- 5.0.56 ]# chown -R mysql /usr/local/mysql/var/
|
[root@www mysql- 5.0.56 ]# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
[root@www mysql- 5.0.56 ]# ldconfig
|
[root@www mysql- 5.0.56 ]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 32342
Starting mysqld daemon with databases from /usr/local/mysql/var
[root@www mysql- 5.0.56 ]# netstat -ntpl | grep 3306
tcp 0 0 0.0.0 .0:3306 0.0.0 .0:* LISTEN 32368/mysqld
[root@www mysql- 5.0.56 ]#
|
[root@www mysql- 5.0.56 ]# cp support-files/mysql.server /etc/init.d/mysqld
cp: overwrite `/etc/init.d/mysqld'? y
[root@www mysql- 5.0.56 ]# chmod +x /etc/init.d/mysqld
[root@www mysql- 5.0.56 ]# chkconfig --add mysqld
[root@www mysql- 5.0.56 ]# chkconfig mysqld on
|
[root@www mysql- 5.0.56 ]# export PATH=$PATH:/usr/local/mysql/bin
[root@www mysql- 5.0.56 ]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
|
[root@www mnt]# tar xjf php- 5.2.6 .tar.bz2 -C /usr/src/
[root@www mnt]# cd /usr/src/
[root@www src]# ls
httpd- 2.2.9 kernels mysql-5.0.56 php-5.2.6 redhat
[root@www src]#cd php- 5.2.6
|
[root@wwwphp- 5.2.6 ]#./configure--prefix=/usr/local/php5
--enable-mbstring--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql
--with-config-file-path=/usr/local/php5
... ...
Thank you for using PHP.
[root@www php- 5.2.6 ]#
|
[root@www php- 5.2.6 ]#make && make install
|
[root@www php- 5.2.6 ]# cp php.ini-dist /usr/local/php5/php.ini
[root@www php- 5.2.6 ]#
|
[root@www php- 5.2.6 ]#vi /usr/local/apache2/conf/httpd.conf
… …
# Example:
# LoadModule foo_module modules/mod_foo.so
LoadModule php5_module modules/libphp5.so //
确认有此行
AddType application/x-httpd-php .php //
添加此行
… …
[root@www php- 5.2.6 ]#
|
[root@www php- 5.2.6 ]#vi /usr/local/apache2/conf/httpd.conf
… …
<IfModule dir_module>
DirectoryIndex index.html index.php
(找到此行,添加
index.php
)
</IfModule>
… …
[root@www php- 5.2.6 ]#
|
[root@www php- 5.2.6 ]# cat /usr/local/apache2/htdocs/pp.php
<?php
phpinfo();
?>
[root@www php- 5.2.6 ]#
|
[root@www php- 5.2.6 ]# cat /usr/local/apache2/htdocs/ppdb.php
<?php
$link=mysql_connect(‘localhost’,’’);
If(!$link) echo “Fail !!”;
Else echo “Success !!”;
Mysql_close();
?>
[root@www php- 5.2.6 ]#
|