CentOS安装lamp+yaf+apc

执行以下脚本:


#!/bin/bash

#yum安装
yum -y install make gcc gcc-c++ perl php php-gd php-devel php-mysql mysql mysql-server pcre-devel

#安装apc
tar zxvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
make && make install
cd ..

#安装yaf
tar zxvf yaf-2.2.9.tgz
cd yaf-2.2.9
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
make && make install
cd ..

#配置防火墙
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart

chown apache:apache /var/www/html

#开机启动
chkconfig httpd on
chkconfig mysqld on

mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak
sed -i 's#extension_dir = "./"#extension_dir = "/usr/lib/php/modules/"nextension = "apc.so"nextension = "yaf.so"n#' /etc/php.ini
sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/g' /etc/httpd/conf/httpd.conf
sed -i 's/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,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen/g' /etc/php.ini
echo "<?php phpinfo(); ?>" >> /var/www/html/index.php

#启动服务
service httpd start
service mysqld start

#设置MySQL密码
echo "Setting MySQL Password..."
mysql -u root <<EOF
use mysql;
update user set password=PASSWORD('123456') where user='root';
flush privileges;
EOF

发表评论