php 5.3.3 46.el6 6,RHEL 6.1最小化编译安装Apache2.2.21+MySQL5.5.17+PHP5.3.8+Zend

2、安装cmake #用来编译MySQL

cd /usr/local/src

tar zxvf cmake-2.8.6.tar.gz

cd cmake-2.8.6

./configure

make #编译

make install #安装

3、安装libmcrypt

cd /usr/local/src

tar zxvf libmcrypt-2.5.7.tar.gz #解压

cd libmcrypt-2.5.7 #进入目录

./configure

make #编译

make install #安装

4、安装mysql

groupadd mysql #添加mysql组

useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统

mkdir -p /data/mysql #创建MySQL数据库存放目录

chown -R mysql:mysql /data/mysql #设置MySQL数据库目录权限

cd /usr/local/src

tar zxvf mysql-5.5.17.tar.gz #解压

cd mysql-5.5.17

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc/

make #编译

make install #安装

cd /usr/local/mysql

cp ./support-files/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:/etc目录下面默认有一个my.cnf,直接覆盖即可)

系统运维 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

vi /etc/my.cnf #编辑配置文件,在 [mysqld] 部分增加

datadir = /data/mysql #添加MySQL数据库路径

./scripts/mysql_install_db --user=mysql #生成mysql系统数据库

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系统启动

chmod 755 /etc/init.d/mysqld #增加执行权限

chkconfig mysqld on #加入开机启动

vi /etc/rc.d/init.d/mysqld #编辑

basedir = /usr/local/mysql #MySQL程序安装路径

datadir = /data/mysql #MySQl数据库存放目录

service mysqld start #启动

vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行

export PATH=$PATH:/usr/local/mysql/bin

下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

shutdown -r now #需要重启系统,等待系统重新启动之后继续在终端命令行下面操作

mysql_secure_installation #设置Mysql密码

根据提示按Y 回车输入2次密码

或者直接修改密码/usr/local/mysql/bin/mysqladmin -u root -p password "123456" #修改密码

service mysqld restart #重启

到此,mysql安装完成!

5、安装apache2

cd /usr/local/src

tar -zvxf httpd-2.2.21.tar.gz

cd httpd-2.2.21

mkdir -p /usr/local/apache2 #创建安装目录

./configure --prefix=/usr/local/apache2 --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi #配置

make #编译

make install #安装

/usr/local/apache2/bin/apachectl -k start #启动

vi /usr/local/apache2/conf/httpd.conf #编辑配置文件

找到:#ServerName

修改为:ServerName localhost:80

找到:DirectoryIndex index.html

修改为:DirectoryIndex index.html index.php

找到:Options Indexes FollowSymLinks

修改为:Options FollowSymLinks #不显示目录结构

vi /etc/profile #添加apache服务系统环境变量

在最后添加下面这一行

export PATH=$PATH:/usr/local/apache2/bin

cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd #把apache加入到系统启动

vi /etc/init.d/httpd #编辑文件

在#!/bin/bash下面添加以下两行

#chkconfig:2345 10 90

#descrption:Activates/Deactivates Apache Web Server

chown daemon.daemon -R /usr/local/apache2/htdocs

chmod -R 700 /usr/local/apache2/htdocs #更改apache网站目录权限

chkconfig httpd on #设置开机启动

service httpd restart #重启

6、安装php

cd /usr/local/src

tar -zvxf php-5.3.8.tar.gz

cd php-5.3.8

mkdir -p /usr/local/php5 #建立php安装目录

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-freetype --with-jpeg --with-png --with-zlib --with-libxml --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --enable-suhosin --enable-session --with-mcrypt #配置

make #编译

make install #安装

mkdir /usr/local/php5/etc

cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录

rm -rf /etc/php.ini #删除系统自带的配置文件

ln -s /usr/local/php5/etc/php.ini /etc/php.ini #创建配置文件软链接

vi /usr/local/php5/etc/php.ini #编辑

找到:;open_basedir =

修改为:open_basedir = .:/tmp/ #防止php木马跨站,重要!!

找到:disable_functions =

修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。

找到:;date.timezone =

修改为:date.timezone = PRC

找到:expose_php = On

修改为:expose_php = OFF #禁止显示php版本的信息

找到:display_errors = On

修改为:display_errors = OFF #关闭错误提示

7、安装Zend Guard

cd /usr/local/src

mkdir /usr/local/zend #建立Zend安装目录

tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz #解压安装文件

cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/ #拷贝文件到安装目录

8、配置php支持Zend Guard系统运维 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值