12年 linux 系统运维工程师,网络架构设计、优化,故障处理。
分类: LINUX
2012-10-11 11:13:52
爱学迁移文档
1、安装apache和php
apt-get install checkinstall
apt-get install apache2 apache2-mpm-prefork
apache2-prefork-dev apache2-utils apache2.2-common
apt-get install mysql-client mysql-client-5.1
mysql-common mysql-server mysql-server-5.1 mysql-server-core-5.1
apt-get install apache2-threaded-dev
apt-get install libtidy-dev curl
libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev
libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev
libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6
libfreetype6-dev libbz2-dev libxaw7-dev libmcrypt-dev libmcrypt4
以上并没有安装php
/gitecroot/download/
去官方下载php的源代码,解压后执行以下步骤
1 编译php源码
sudo ./configure \
--with-apxs2=/usr/bin/apxs2 \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-tidy=/usr \
--with-curl=/usr/bin \
--with-openssl \
--with-openssl-dir=/usr \
--with-kerberos=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-pdo-mysql=mysqlnd \
--with-xsl=/usr \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-snmp=/usr \
--enable-exif \
--enable-cli \
--enable-calendar \
--with-bz2=/usr \
--with-mhash \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-freetype-dir=/usr \
--enable-zend-multibyte \
--enable-mbstring \
--enable-mbregex \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-zip \
--enable-ftp \
--with-pear \
--disable-debug
2 编译后 make ,
test make, make
install
3 sudo vi /etc/apache2/mods-available/php53x.load 写入如下内容
LoadModule php5_module /gitecroot/download/php-5.3.6/libs/libphp5.so(使用源码包的php5文件)
AddType application/x-httpd-php .php .phtml
.php3
AddType application/x-httpd-php-source
.phps
PHPIniDir /root/src/php-5.3.x/libs
4 执行以下几行
如果已经装了php,建议最后安装php
a2dismod php5
执行这行启用php
a2enmod php53x
/etc/init.d/apache2 restart
如果运行php程序显示找不到/tmp/mysql.sock
sudo nano /etc/my.cnf
将所有socket
= /var/run/mysqld/mysqld.sock 改成socket =
/tmp/mysql.sock
重启
2、安装apc和xdebug
/gitecroot/download/
Configure
Make
make test
make install
3、拷贝php.ini
Cp –r /gitecroot/download/php-5.3.6/php.ini-production /usr/local/lib/php.ini
4、拷贝相关so文件到/gitecroot/so/
5、sudo vi /usr/local/lib/php.ini
添加
end_extension="/gitecroot/so/xdebug.so"
extension = /gitecroot/so/apc.so
apc.rfc1867 = on
display_errors = Off
timezone = Asia/Chongqing
6、sudo ln /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
7、拷贝home/font/arial.ttf 到相同目录下
8、更改php.ini
upload_max_filesize =20
post_max_size =20
9、修改config和db_config