平淡的流年

BLOG&PAGE

apache,php,mysql编译

发布时间:2016-8-15 编辑:流年 阅读(280)

cd apr-1.5.1

./configure --prefix=/usr/local/apr

make && make install


cd apr-util-1.5.4

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make && make install


cd pcre-8.36

./configure

make && make install


都完成后正式安装Apache

cd httpd-2.4.10

./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so --enable-rewrite

make && make install


cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

service httpd start

测试是否安装成功


出现“It works”就说明Apache已经正常安装。



2. 安装Mysql

需要先安装好 cmake

yum -y install cmake make


cd mysql-5.5.21


cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFIGDIR=/usr/local/mysql/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql

make && make install

配置mysql 5.5.21

cp /usr/loacl/mysql/support-files/my-huge.cnf etc/my.cnf

vi /etc/my.cnf

修改my.cnf配置,把innodb相关选项前面的#去掉,大概在115-130行之间。




以下命令为mysql 启动及自启动配置

cp /usr/loacl/mysql/support-files/mysql.server /etc/init.d/mysqld

 /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &

chkconfig --add mysqld

chkconfig --level 345 mysqld on

 

service mysqld start 

一般只要把my.cnf设置好这里就不会报错


剩下mysql 的账号密码数据库等更改创建就还是老规矩了


3. 安装PHP5.6


'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-openssl' '--with-mysqli=mysqlnd' '--enable-mbstring' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--enable-sockets' '--enable-fpm' '--with-mcrypt' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--with-bz2' '--with-gd' '--with-curl'


有时候,CentOS会在编译过程中报错 mcrypt.h not found. Please reinstall libmcrypt


解决办法一

1、安装第三方yum源

wget http://www.atomicorp.com/installers/atomic

sh ./atomic

2、使用yum命令安装

yum  install  php-mcrypt  libmcrypt  libmcrypt-devel

     


解决办法二、

使用php mcrypt 前必须先安装Libmcrypt


apache配置文件httpd.conf相关修改以支持PHP

vim /usr/local/apache/conf/httpd.conf

1. 添加php支持。

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

2. 添加默认索引页面index.php,再找到“DirectoryIndex”,在index.html后面加上“ index.php”

DirectoryIndex index.html index.php

3. 不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为

Options FollowSymLinks

4. 开启Apache支持伪静态,找到“AllowOverride None”,修改为

AllowOverride All

保存httpd.conf配置,然后再执行以下两行命令

 chown -R nobody. /usr/local/apache/htdocs/

chmod -R 777 /usr/local/apache/htdocs/

 service httpd restart


./configure --prefix=/alidata/server/php55 --with-config-file-path=/etc --with-apxs2=/alidata/server/httpd/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib  --with-iconv --with-gd --with-xmlrpc --enable-mbstring --without-sqlite --with-curl --enable-ftp --with-mcrypt --with-freetype-dir=/usr/local/freetype.2.1.10 --with-jpeg-dir=/usr/local/jpeg.6 --with-png-dir=/usr/local/libpng.1.2.50 --disable-ipv6 --disable-debug --disable-maintainer-zts --disable-safe-mode --disable-fileinfo


----平淡的流年

暂无评论

添加新评论