系统环境Centos 5.2,全新安装,最小化安装,只安装了最基本的工具
升级系统,安装必要的程序
yum upgrade
yum install screen gcc gcc-c++ autoconf openssl-devel curl-devel libXpm-devel freetype-devel libmcrypt aspell-devel
编译安装一些必要的程序,也可以用yum安装
libxml2 gdbm libjpeg-6b libpng libxpm libiconv ncurses mhash expat libxslt
都很简单,直接
./configure
make && make install
编译安装apache
./configure –enable-module=so –enable-module=rewrite –enable-module=info –enable-module=expires –enable-module=headers –enable-module=log_agent –enable-module=log_referer –enable-module=proxy –enable-suexec –logfiledir=/usr/local/apache/logs –prefix=/usr/local/apache –suexec-caller=nobody –suexec-docroot=/ –suexec-gidmin=100 –suexec-logfile=/usr/local/apache/logs/suexec_log –suexec-uidmin=100 –suexec-userdir=public_html –sysconfdir=/usr/local/apache/conf
编译安装mysql
添加用于运行数据库的用户mysql
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin -r
mkdir -p /home/mysql_data/mysql
chown mysql:mysql /home/mysql_data/mysql
下载MySQL源文件,编译安装
./configure –prefix=/usr/local/mysql-5.0 –with-mysqld-ldflags=-all-static –with-big-tables –with-mysqld-user=mysql –without-debug –with-extra-charsets=all –bindir=/usr/local/bin –sysconfdir=/etc –localstatedir=/home/mysql_data/mysql –with-comment=”PaanGood Network MySQL Server”
make && make install
下载PHP源文件,编译安装
编译安装php(两次,cli和fcgi)
./configure –prefix=/usr/local/php5 –disable-posix –enable-bcmath –enable-calendar –enable-discard-path –enable-exif –enable-fastcgi –enable-ftp –enable-gd-native-ttf –enable-libxml –enable-magic-quotes –enable-mbstring –enable-soap –enable-sockets –enable-track-vars –enable-wddx –enable-zip –with-apxs=/usr/local/apache/bin/apxs –with-curl=/usr/bin/curl –with-dom –with-freetype-dir=/usr –with-gd –with-gdbm –with-gettext –with-iconv=/usr/local –with-jpeg-dir=/usr –with-kerberos –with-libexpat-dir=/usr –with-libxml-dir=/usr –with-mcrypt=/usr –with-mhash –with-mysqli=/usr/local/mysql-5.0/bin/mysql_config –with-mysql=/usr/local/mysql-5.0 –with-openssl –with-pdo-mysql=/usr/local/mysql-5.0 –with-pdo-sqlite=shared –with-png=/usr/lib –with-pspell –with-sqlite=shared –with-ttf –with-xml –with-xmlrpc –with-xpm-dir=/usr/X11R6 –with-xsl –with-zlib –with-zlib-dir=/usr
./configure –prefix=/usr/local/php5 –disable-posix –enable-bcmath –enable-calendar –enable-discard-path –enable-exif –enable-fastcgi –enable-ftp –enable-gd-native-ttf –enable-libxml –enable-magic-quotes –enable-mbstring –enable-soap –enable-sockets –enable-track-vars –enable-wddx –enable-zip –enable-force-cgi-redirect –with-curl=/usr/bin/curl –with-dom –with-freetype-dir=/usr –with-gd –with-gdbm –with-gettext –with-iconv=/usr/local –with-jpeg-dir=/usr –with-kerberos –with-libexpat-dir=/usr –with-libxml-dir=/usr –with-mcrypt=/usr –with-mhash –with-mysqli=/usr/local/mysql-5.0/bin/mysql_config –with-mysql=/usr/local/mysql-5.0 –with-openssl –with-pdo-mysql=/usr/local/mysql-5.0 –with-pdo-sqlite=shared –with-png=/usr/lib –with-pspell –with-sqlite=shared –with-ttf –with-xml –with-xmlrpc –with-xpm-dir=/usr/X11R6 –with-xsl –with-zlib –with-zlib-dir=/usr
make
make test
make install
配置apache支持php
设置目录
mkdir /usr/local/apache/cgi-sys/
cp /usr/local/php5/bin/php-cgi /usr/local/apache/cgi-sys/
chmod 711 /usr/local/apache/cgi-sys/
chmod 755 /usr/local/apache/cgi-sys/php-cgi
chown root.wheel /usr/local/apache/cgi-sys/ -R
httpd.conf加入两行
ScriptAlias /cgi-sys/ /usr/local/apache/cgi-sys/
Include “/usr/local/apache/conf/php.conf”
php.conf内容如下
Action application/x-httpd-php5 /cgi-sys/php-cgi
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
#LoadModule php5_module libexec/libphp5.so
#AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
参考
ServerName newphp.net
ServerAlias
DocumentRoot /home/newphp/public_html
ServerAdmin
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/newphp.net combined
BytesLog /usr/local/apache/domlogs/newphp.net-bytes_log
User newphp
Group newphp
Userdir disabled
Userdir enabled newphp
php4_admin_value open_basedir “/home/newphp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp”
php5_admin_value open_basedir “/home/newphp:/usr/lib/php:/usr/local/lib/php:/tmp”
php_admin_value open_basedir “/home/newphp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp”
php_admin_value open_basedir “/home/newphp:/usr/lib/php:/usr/local/lib/php:/tmp”
ScriptAlias /cgi-bin/ /home/newphp/public_html/cgi-bin/
阅读(1528) | 评论(0) | 转发(0) |