首先看看市面上流行的有哪些框架,统计可能对国内来说有些偏差。1、第一步,安装你的web开发环境在五花八门的语言里,PHP作为我第一个觉得欣赏的理由,就是它的简单和快捷,因为它封装了许多的常用函数。PHP作为网站中一种算作比较流行的语言,也产生各种优秀的框架。我所接触过的有zend framework 1、think php、yii框架,这些框架中属zend framework似乎不太尽人意,因为作为官方的框架,大家给予的期望也是比较高的,但是在国内这个框架用的并不多。可是我作为一个还算比较忠实的PHP爱好者,我还是用zend framework 1搭建了第一个属于自己的网站——仿动网论坛。不说曾经了,zend framework 2似乎是去年出来的吧,我也捣鼓过一段时间,因为后来工作的关系,我逐渐很少去研究这个了。现在国内的这方面资料还非常稀缺,虽然有人已经翻译了官方的文档,但是我想对于初学者来说还是很难上手。特别是搭建开发环境的,我就更少看见了,要么是笼统的概括,要么就是凌乱的东拼西凑。本文供给那些想要了解新框架的人,也同时为自己做一个笔记,因为这些东西随着时间的推移是会渐渐淡忘的。
你可以去找一些集成lnmp的脚本,或者使用我提供的这个脚本进行基础的环境安装,下面的代码下载后保存为install_web_develop.sh,怎么运行请百度shell脚本运行。
#!/bin/bash#filename:test.sh#author:viticm#createtime:2013-5-31 11:12:03#use: install web developcUser=`whoami`cCommand=$1cDownload=oncBase=nocWebUser=wwwcInstallFile=/web/cInstallPhpPath=/usr/local/php/cInstallNginxPath=/usr/local/nginx/cInstallMySQLPath=/usr/local/mysql/cPhpMakefile=/home/MakefileiSystemType=`getconf LONG_BIT`Arr_OpenPortList=""cTestDomain=www.baidu.com##### mysql config #####cMysqlDefaultPasswd=mysqlcMysqlInstallPath=/usr/local/mysql/cMysqlConfUploadFile=`pwd`/my.cnf##### mysql config ############ PHP #######cDate_TimeZone="Asia/Shanghai"cDisplay_Errors=OncError_Reporting="E_ALL & ~E_NOTICE"cAllow_Call_Time_Pass_Reference=On###### PHP ############ PHP-FPM CONFIGS ####pm_max_children=64 pm_start_servers=20pm_min_spare_servers=5pm_max_spare_servers=35pm_max_requests=1024pm_user=${cWebUser}pm_group=${cWebUser}#### PHP-FPM CONFIGS ####usage(){cat <<EOFUsage: $0 <params>-m or --mysql install mysql-n or --nginx install nginx-p or --php install php( and this can enter two params,like -p 5.3( 5.4 ) then install php what version is 5.3 )EOFreturn 0}# on OEL, /etc/issue states "EnterPRise Linux Enterprise Linux Server"SUPPORTED_OS='CentOS|Red Hat Enterprise Linux Server|Enterprise Linux Enterprise Linux Server|Fedora|SUSE|Debian GNU/Linux|Ubuntu|Oracle Linux Server'if ! egrep -q "$SUPPORTED_OS" /etc/issue ; thencat <<EOFUnable to install: Your distribution is not suitable for installation usingZend's DEB/RPM repositories. EOF exit 1fi# -v or --versionif [ "$1" = "-v" -o "$1" = "--version" ]; then echo "`basename $0` version 1.0.1" usage exit 0fi# -h or --helpif [ "$1" = "-h" -o "$1" = "--help" ]; then usage exit 0fiMYUID=`id -u 2> /dev/null`if [ ! -z "$MYUID" ]; then if [ $MYUID != 0 ]; then echo "You need root privileges to run this script."; #exit 2 fielse echo "Could not detect UID"; exit 2ficat <<EOFHit ENTER to install web develop, or Ctrl+C to abort now.EOF# give read a parameter, as it required in dashread answer#Basefunction InstallBasePackage(){ echo echo "************************************************************************" echo "* Start install Base package( vim git wget base for mysql php nginx ). *" echo "************************************************************************"#clean iptables# echo -e "\e[0;36;1mfirst will clean iptables,please wait.\e[0m"# iptables -F# iptables -X# iptables -Z if [[ ${cBase} == "ok" ]] ; then echo -e "\e[0;35;1myour base is ok,now will not install base package.\e[0m" else #it will download from network . echo -e "\e[0;33;1mnow will test your network if worked,please wait some time.\e[0m" ping -c 5 ${cTestDomain} if [[ $? -ne 0 ]] ; then echo -e "\e[0;31;1myour network not worked,please check it.\e[0m" exit 1 else echo -e "\e[0;35;1myour network is worked,now will download from your network.\e[0m" fi fi if [[ ${cBase} == "no" ]] ; then#vim# yum -y install vim yum -y install ctags yum -y install cscope yum -y install ntp#git yum -y install git#wget yum -y install wget#gcc yum -y install yum-fastestmirror yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers#Nginx yum -y install pcre-devel zlib-devel readline-devel#Php yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel freetype-devel#Mysql yum -y install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel*#bc yum -y install bc fi#synchronous time chkconfig ntpd on ntpdate cn.pool.ntp.org hwclock --systohc#config ulimit configs echo now will config limit allow handles. echo "* soft nofile 2048" >> /etc/security/limits.conf echo "* hard nofile 32768" >> /etc/security/limits.conf echo "config limits is ok, remember reboot your server." if [[ $? -ne 0 ]] ; then echo -e "\e[0;31;1minstall base is failed.\e[0m" exit 1 fi echo echo "**************************************" echo "* Install base package is completed. *" echo "**************************************"}#Mysqlfunction InstallMysql(){ echo echo "**********************************************" echo "* Start install mysql( Percona-Server-5.6 ). *" echo "**********************************************" local cMysqlPackage="Percona-Server-5.6.10-alpha60.2.tar.gz" local cMysqlPackageDir="Percona-Server-5.6.10-alpha60.2" if [[ ${cBase} == "no" ]] ; then yum -y install make yum -y install cmake yum -y install libtermcap-devel yum -y install patch yum -y install perl yum -y install bison fi if [[ ${cDownload} == "off" ]] ; then cd ${cInstallFile} fi if [ -x ./${cMysqlPackageDir} ] then#rm -fr Percona-Server-5.1.62 echo "Percona is exists,use it." else if [ -f ./${cMysqlPackage} ] then tar -zxvf ${cMysqlPackage} else wget -c http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.10-alpha60.2/source/Percona-Server-5.6.10-alpha60.2.tar.gz if [[ $? -ne 0 ]] ; then echo "download mysql is failed,please check your network." exit 1 fi sleep 3 tar -zxvf ${cMysqlPackage} fi fi echo "start install mysql" sleep 3 #delete mysql install directory cd ${cMysqlPackageDir} if [[ "" != `ps -A | grep mysqld` ]]; then PRINTWARNING "mysql is install and run now will uninstall it, or Ctrl+C to abort now." read answer service mysql stop# make clean# make uninstall rm -rf ${cMysqlInstallPath} fi CC=gcc CFLAGS="-DBIG_JOINS=1 -DHAVE_DLOPEN=1 -O3" CXX=g++ CXXFLAGS="-DBIG_JOINS=1 -DHAVE_DLOPEN=1 -felide-constructors -fno-rtti -O3" cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/var/mysql/data sleep 3 make -j4 && make install groupadd mysql useradd -g mysql mysql cd ${cMysqlInstallPath} && chown -R mysql . && chgrp -R mysql . echo "make install is ok" sleep 3 mkdir -p /var/mysql/data && chown mysql:mysql /var/mysql/ -R if [[ -f ${cMysqlConfUploadFile} ]] ; then cp ${cMysqlConfUploadFile} /etc/my.cnf else cp ${cMysqlInstallPath}support-files/my-default.cnf /etc/my.cnf #sed "s/skip-locking/external-locking/g" -i /etc/my.cnf #sed "s/#innodb_/innodb_/g" -i /etc/my.cnf #sed -i '32 i\default-storage-engine=InnoDB' -i /etc/my.cnf fi ${cMysqlInstallPath}/scripts/mysql_install_db --basedir=${cMysqlInstallPath}/ --user=mysql --datadir=/var/mysql/data ln -s /usr/local/my