Couldn't resolve host 'mirrors.163.comphp
//update by 2014.05.22html
編譯php 5.5.12出現的問題mysql
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=nolinux
vi /etc/ld.so.conf.d/local.conf # 編輯庫文件 /usr/local/lib # 添加該行 :wq # 保存退出 ldconfig -v # 使之生效
export LD_LIBRARY_PATH=/lib/:/usr/lib/:/usr/local/lib shell
解決辦法添加下面數據庫
vim /etc/resolv.conf
nameserver 8.8.8.8
2.http://www.9php.net/article/20130421195412.html
http://centos.ustc.edu.cn/ 教育yum資源地址
一、先備份 /etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
二、進入 http://mirrors.163.com/.help/centos.html 下載 CentOS6-Base-163.repo,放入 /etc/yum.repos.d/ 。
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
三、運行 yum makecache 生成緩存
3.linux終端命令 上傳文件到服務器
yum install openssh-clients
scp -P 端口號 -r CentOS6-Base-163.repo 用戶名@IP:/home/xiecl
在此列出scp的使用方法 引用
http://www.vpser.net/manage/scp.html
yum -y install gcc gcc-c++ make cmake zlib zlib-devel ncurses-devel ncurses bison
//nginx
./configure --prefix=/usr/local/webserver/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/home/xiecl/openssl-1.0.1 --with-pcre=/home/xiecl/ss/pcre-8.33
//設置開機啓動腳本
======================================================= #!/bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig: - 85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/webserver/nginx/conf/nginx.conf nginxd=/usr/local/webserver/nginx/sbin/nginx nginx_config=/usr/local/webserver/nginx/conf/nginx.conf nginx_pid=/usr/local/webserver/nginx/logs/nginx.pid RETVAL=0 prog="nginx" # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit 1 fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/webserver/nginx/logs/nginx.pid } reload() { echo -n $"Reloading $prog: " #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL =======================================================
/usr/local/webserver/nginx/sbin/nginx #啓動nginx
groupadd www #添加www組
useradd -g www www -s /bin/false #建立nginx運行帳戶www並加入到www組,不容許www用戶直接登陸系統
設置nginx開啓啓動
vi /etc/rc.d/init.d/nginx #編輯啓動文件添加以上內容
chmod a+x /etc/rc.d/init.d/nginx
vi /etc/rc.local
加入一行 /etc/rc.d/init.d/nginx start 保存並退出,下次重啓會生效。
2、安裝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數據庫目錄權限
mkdir -p /usr/local/webserver/mysql #建立MySQL安裝目錄
cd /home/xiecl/mysql-5.6.13
tar zxvf mysql-5.6.13.tar.gz #解壓
cd mysql-5.6.13
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
make && make install
cp ./support-files/my-default.cnf /etc/my.cnf (注意:若是/etc目錄下面默認有一個my.cnf,直接覆蓋便可)
vi /etc/my.cnf
./scripts/mysql_install_db -user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
vi /etc/rc.d/init.d/mysqld
basedir=/usr/local/webserver/mysql
datadir=/usr/local/webserver/mysql/data
service mysqld start #啓動
vi /etc/profile #把mysql服務加入系統環境變量:在最後添加下面這一行
export PATH=$PATH:/usr/local/webserver/mysql/bin
:wq! #保存退出
ln -s /usr/local/webserver/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/webserver/mysql/include/mysql /usr/include/mysql
mysql_secure_installation #設置Mysql密碼
根據提示按Y 回車
而後輸入2次密碼
繼續按Y 回車,直到設置完成
或者直接修改密碼/usr/local/webserver/mysql/bin/mysqladmin -u root -p password 「123456″ #修改密碼
安裝php
ln -s /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/lib
ldconfig
yum install -y php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel libxml2-devel openssl openssl-devel libcurl libcurl-devel libpng-devel
yum install freetype freetype-devel
configure: error: Cannot find ldap.h
yum install openldap yum install openldap-devel
cp -frp /usr/lib64/libldap* /usr/lib/
libmcrypt 編譯安裝
解決1.在/etc/ld.so.conf中加一行/usr/local/lib,
2.而後運行/sbin/ldconfig
錯誤提示2 cp: cannot stat `ext/phar/phar.phar': No such file or directory
cd ext/phar/
cp ./phar.php ./phar.phar
cp php.ini-production /usr/local/webserver/php/etc/php.ini
ln -s /usr/local/webserver/php/etc/php.ini /etc/php.ini
cp /usr/local/webserver/php/etc/php-fpm.conf.default /usr/local/webserver/php/etc/php-fpm.conf
vi /usr/local/webserver/php/etc/php-fpm.conf #編輯
user = www #設置php-fpm運行帳號爲www
group = www #設置php-fpm運行組爲www
pid = run/php-fpm.pid #取消前面的分號
在源碼目錄下
/home/xiecl/php-5.4.24
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
//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版本的信息
找到:short_open_tag = Off
修改成:short_open_tag = ON #支持php短標籤
引用配置地址
http://www.cnblogs.com/eter/p/l_c_6_000006.html
php-fpm啓動腳本地址
http://www.lovelucy.info/nginx-phpfpm-init-script.html
#!/bin/bash## Startup script for the PHP-FPM server.## chkconfig: 345 85 15# description: PHP is an HTML-embedded scripting language# processname: php-fpm# config: /usr/local/php/etc/php.ini # Source function library.. /etc/rc.d/init.d/functions PHP_PATH=/usr/localDESC="php-fpm daemon"NAME=php-fpm# php-fpm路徑DAEMON=$PHP_PATH/php/sbin/$NAME# 配置文件路徑CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf# PID文件路徑(在php-fpm.conf設置)PIDFILE=$PHP_PATH/php/var/run/$NAME.pidSCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed.test -x $DAEMON || exit 0 rh_start() { $DAEMON -y $CONFIGFILE || echo -n " already running"} rh_stop() { kill -QUIT `cat $PIDFILE` || echo -n " not running"} rh_reload() { kill -HUP `cat $PIDFILE` || echo -n " can't reload"} case "$1" in start) echo -n "Starting $DESC: $NAME" rh_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" rh_stop echo "." ;; reload) echo -n "Reloading $DESC configuration..." rh_reload echo "reloaded." ;; restart) echo -n "Restarting $DESC: $NAME" rh_stop sleep 1 rh_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 exit 3 ;;esacexit 0
chmod +x /etc/init.d/php-fpm
/sbin/chkconfig php-fpm on
/sbin/chkconfig --list php-fpm
service php-fpm start service php-fpm stop service php-fpm restart service php-fpm reload /etc/init.d/php-fpm start/etc/init.d/php-fpm stop/etc/init.d/php-fpm restart/etc/init.d/php-fpm reload