标签:
1.软件包
httpd-2.2.31.tar.gz
mysql-5.1.63.tar.gz
php-5.6.17.tar.bz2
2.安装apache
tar xzf httpd-2.2.31.tar.gz
cd httpd-2.2.31
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
make
make install
3.安装mysql
tar xzf mysql-5.1.63.tar.gz
cd mysql-5.1.63
./configure prefix=/usr/local/mysql5 --enable-assembler
#error: No curses/termcap library found
#解决办法
#yum install ncurses-devel
make
make install
配置mysql服务为系统服务
cp /usr/local/mysql5/share/mysql/my-medium.cnf /etc/my.cnf
cp /usr/local/mysql5/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld #增加mysqld为系统服务
chkconfig --level 345 mysqld on #在系统登记345级中开启mysqld服务
#创建mysql用户并更改权限
cd /usr/local/mysql5
useradd mysql
chown -R mysql.mysql /usr/local/mysql5
#初始化数据库
/usr/local/mysql5/bin/mysql_install_db --user=mysql
设置var目录权限
chown -R mysql var
#后台启动mysql
/usr/local/mysql5/bin/mysqld_safe --user=mysql &
#软链接mysql命令
ln -s /usr/local/mysql5/bin/mysql /usr/bin/
3.php安装和配置
tar jxf php-5.3.28.tar.bz2
cd php-5.3.28
#error: xml2-config not found. Please check your libxml2 installation.
#yum install libxml2 libxml2-devel
./configure prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql5/
make
make install
4.Apache+PHP
修改httpd.conf文件,加入以下语句
LoadModule php5_module modules/libphp5.so (默认已存在)
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html (把index.php加入index.html之前)
在/usr/local/apache2/htdocs下创建测试页面,页面内容如下:
<?php
phpinfo();
?>
运行地址,跳出测试换面,安装成功。
标签:
原文地址:http://www.cnblogs.com/yl-2016/p/5163702.html