`
tomhibolu
  • 浏览: 1383058 次
文章分类
社区版块
存档分类
最新评论

linux下安装PHP APACHE MYSQL 手记

 
阅读更多

/**********************************

APACHE

***********************************/

编辑参数:

./configure" /
"--prefix=/usr/local/apache" /

"--enable-rewrite"/
"--enable-so" /
"--enable-ssl" /
"--enable-mods-shared=most" /
"--with-mpm=worker" / 注意,如果是worker模式的话,则PHP安装ZendOptimizer会失败,如果需要安装ZO则只能用prefork 或不指定,默认就是prefork


"--with-ssl=/usr/local/openssl" / 要事先安装openssl,下载源码后configure一下,然后make就可以了,


//下面几项听说只是刚过完测试阶段,所以一般最好不要编译进去,我试过一次,如果编译进去的话,总被缓存,添加一个文件半天都提示找不到,最后我重编译把他给去掉了

"--enable-cache" /
"--enable-mem-cache" /
"--enable-disk-cache" /
"--enable-file-cache" /
"--enable-nonportable-atomics-yes" /

使apache 支持shtml:

----------------------------start

编辑:httpd.conf

去掉下面两行的注释
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

添加Includes
Options -Indexes FollowSymLinks Includes

允许目录浏览:
Options Indexes FollowSymLinks Includes

------------------------------end--

/*************************************

MYSQL

******************************************/

现在MYSQL下载下来基本都是二进制,也可以下源码安装,但总体来说二进制的安装起来比较方便,但有些情况下则需要手动编译,

先说下二进制安装:

下载文件

然后解压

#tar zxvf mysql-XXX.tar.gz

#cp mysql-XXX /usr/local/mysql
# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql #初试化表并且规定用mysql用户来访问
# chown -R root /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
# chgrp -R mysql /usr/local/mysql
# chown -R root /usr/local/mysql/bin
# bin/safe_mysqld --user=mysql &

groupadd mysql #创建MYSQL用户

useradd mysql -g mysql #建立mysql用户并且加入到mysql组中

# /usr/local/mysql/libexec/mysqld start #启动mysql
# /usr/local/mysql/libexec/mysqld stop #停止mysql
# /usr/local/mysql/libexec/mysqld restart #重启mysql

脚本启动方法:

mysql_start.sh

#! /bin/sh
/usr/local/mysql/bin/mysqld_safe&

也可以:


cd /usr/local/mysql/support-files/
chmod a+x mysql.server
./mysql.server start

cd /usr/local/bin/
ln -s /usr/local/mysql/bin/mysql mysql
ln -s /usr/local/mysql/support-files/mysql.server mysql.server

以后可以直接运行mysql来启动MYSQL客户端,mysql.server来启动服务端

/****************************

PHP

******************************/


curl:

./configure --prefix=/usr/local/curl
make
make install

#cannot --prefix=/usr/local/zlib
zlib:
./configure --shared
make
make install


freetype
./configure --prefix=/usr/local/freetype
make
make install


#--prefix=/usr/local/libpng
libpng
tar -vxzf libpng-1.2.33.tar.gz
./configure
make
make install

jpegsrc
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man1
mkdir -p /usr/local/jpeg6/man/man1
tar -vxzf jpegsrc.v6b.tar.gz
################
cd jpeg-6b/
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
修改Makfile LIBTOOL = /usr/bin/libtool --这句,如果后面make成功的话就不用改了!有时改了反而会出错!
make
make install

gd-2.0.33
tar -vxzf gd-2.0.33.tar.gz
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/ --with-freetype=/usr/local/freetype/
make
make install

-------------------上面这几个,有些系统可以通过自身的软件更新来直接安装,而不需要另行安装,如果另安装反而还容易出错-------------

php:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-sockets --enable-mbstring --with-bz2=shared --with-iconv=shared --with-mysql=/usr/local/mysql/ --with-curl=/usr/local/curl --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/local/lib/ --with-png-dir==/usr/local/lib/ --with-freetype-dir=/usr/local/freetype/ --with-pdo-mysql=/usr/local/mysql

不知道为什么,以上按装GD内的PNG就是不支持,至今不明白。希望有高人指点!

增加支持:mcrypt

下载下面三个包

Libmcrypt

mcrypt

mhash

安装

#tar -zxvf libmcrypt-2.5.8.tar.gz

#cd libmcrypt-2.5.8

#./configure

#make

#make install

#tar -zxvf mhash-0.9.9.9.tar.gz

#cd mhash-0.9.9.9

#./configure

#make

#make install

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local ./configure

#make

#make install

说明:由于在配置Mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/文件夹下。因些在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local导入键接库

进入PHP安装目录的ext/mcrypt下面

执行/usr/local/php/bin/phpize

./configure--with-php-config=/usr/local/php/bin/php-config

make

make install

之后系统会提示你mcrypt.so文件所在的目录。根据php.ini中指示的extension_dir指向的目录中, 将其复制过去。

修改php.ini,在最后添加一句extension=mcrypt.so

最后更新:2010-01-10 0:06

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics