在CentOS6.4下使用gdb进行调试的时候,
使用bt(breaktrace)命令时,会弹出如下的提示:
头一天提示:
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.i686
问题没解决,第二天提示:
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686
但是直接按提示使用 debuginfo-install glibc-2.12-1.132.el6.i686 去安装的时候会报如下的信息:
Loaded plugins: fastestmirror, refresh-packagekit Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.yun-idc.com * updates: mirrors.yun-idc.com Checking for new repos for mirrors No debuginfo packages available to install
使用yum来进行安装:
sudo yum --nogpgcheck --enablerepo=debug install glibc-debuginfo
却提示:Error Downloading Packages: glibc-debuginfo-common-2.12-1.132.el6.i686: failure: glibc-debuginfo-common-2.12-1.132.el6.i686.rpm from debug: [Errno 256] No more mirrors to try.
使用yum install glibc安装,发现只是安装了一些基本库,不包含 glibc-debuginfo
后来搜索发现需要先修改“/etc/yum.repos.d/CentOS-Debuginfo.repo”文件的enable=1
文件内容如下:
- # CentOS-Debug.repo
- #
- # The mirror system uses the connecting IP address of the client and the
- # update status of each mirror to pick mirrors that are updated to and
- # geographically close to the client. You should use this for CentOS updates
- # unless you are manually picking other mirrors.
- #
- # All debug packages from all the various CentOS-5 releases
- # are merged into a single repo, split by BaseArch
- #
- # Note: packages in the debuginfo repo are currently not signed
- #
- [debug]
- name=CentOS-6 - Debuginfo
- baseurl=http://debuginfo.centos.org/6/$basearch/
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
- enabled=1
保存之后,使用 debuginfo-install glibc-2.12-1.132.el6.i686 安装,输出如下:
- Loaded plugins: fastestmirror, refresh-packagekit
- Loading mirror speeds from cached hostfile
- * base: mirrors.yun-idc.com
- * extras: mirrors.yun-idc.com
- * updates: mirrors.yun-idc.com
- debug | 2.5 kB 00:00
- Checking for new repos for mirrors
- --> Running transaction check
- ---> Package glibc-debuginfo.i686 0:2.12-1.132.el6 will be installed
- --> Processing Dependency: glibc-debuginfo-common = 2.12-1.132.el6 for package: glibc-debuginfo-2.12-1.132.el6.i686
- ---> Package nss-softokn-debuginfo.i686 0:3.12.9-11.el6 will be installed
- ---> Package yum-plugin-auto-update-debug-info.noarch 0:1.1.30-17.el6_5 will be installed
- --> Running transaction check
- ---> Package glibc-debuginfo-common.i686 0:2.12-1.132.el6 will be installed
- --> Finished Dependency Resolution
- Dependencies Resolved
- =============================================================================================================================================================
- Package Arch Version Repository Size
- =============================================================================================================================================================
- Installing:
- glibc-debuginfo i686 2.12-1.132.el6 debug 10 M
- nss-softokn-debuginfo i686 3.12.9-11.el6 debug 1.0 M
- yum-plugin-auto-update-debug-info noarch 1.1.30-17.el6_5 updates 22 k
- Installing for dependencies:
- glibc-debuginfo-common i686 2.12-1.132.el6 debug 7.5 M
- Transaction Summary
- =============================================================================================================================================================
- Install 4 Package(s)
- Total size: 19 M
- Total download size: 8.6 M
- Installed size: 93 M
- Is this ok [y/N]: y
- Downloading Packages:
- (1/3): glibc-debuginfo-common-2.12-1.132.el6.i686.rpm | 7.5 MB 12:03
- (2/3): nss-softokn-debuginfo-3.12.9-11.el6.i686.rpm | 1.0 MB 01:56
- (3/3): yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch.rpm | 22 kB 00:00
- -------------------------------------------------------------------------------------------------------------------------------------------------------------
- Total 10 kB/s | 8.6 MB 14:10
- Running rpm_check_debug
- Running Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Installing : glibc-debuginfo-common-2.12-1.132.el6.i686 1/4
- Installing : glibc-debuginfo-2.12-1.132.el6.i686 2/4
- Installing : yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch 3/4
- Installing : nss-softokn-debuginfo-3.12.9-11.el6.i686 4/4
- Verifying : glibc-debuginfo-common-2.12-1.132.el6.i686 1/4
- Verifying : nss-softokn-debuginfo-3.12.9-11.el6.i686 2/4
- Verifying : glibc-debuginfo-2.12-1.132.el6.i686 3/4
- Verifying : yum-plugin-auto-update-debug-info-1.1.30-17.el6_5.noarch 4/4
- Installed:
- glibc-debuginfo.i686 0:2.12-1.132.el6 nss-softokn-debuginfo.i686 0:3.12.9-11.el6 yum-plugin-auto-update-debug-info.noarch 0:1.1.30-17.el6_5
- Dependency Installed:
- glibc-debuginfo-common.i686 0:2.12-1.132.el6
- Complete!
OK,问题解决。
第二次安装总结:
1、需要先修改“/etc/yum.repos.d/CentOS-Debuginfo.repo”文件的enable=1;
2、使用 sudo yum install glibc 安装;
3、使用 debuginfo-install glibc-2.12-1.132.el6.i686 安装。
测试,安装成功。
下面不太好了
yum --nogpgcheck --enablerepo=debug install glibc-debuginfo cyrus-sasl-debuginfo keyutils-debuginfo krb5-debuginfo libselinux-debuginfo libssh2-debuginfo libxml2-debuginfo nspr-debuginfo nss-debuginfo nss-softokn-debuginfo nss-util-debuginfo openldap-debuginfo openssl-debuginfo zlib-debuginfo
rpm -ivh libidn-debuginfo-1.32-1.fc23.x86_64.rpm
http://rpmfind.net/linux/rpm2html/search.php?query=libidn-debuginfo(x86-64)
https://www.baidu.com/link?url=Mf_Pi0CDxpjkpHoqOYE2Sp9FkSSWvTVMqgsyG0JhS0dN7TvMScKifI1X-oGAIYpkCVpz8WVi3kOvMKumYj_YLHCxtSUV5wnYUH3kDHbpYFn-4xuxLT5Jh0LkxIvLxHpIvaJolYiem858JvSxCME98vuz-ZSToSf3IxdmZwvAWxq&wd=&eqid=aaf78b5000018cbb00000002564edc55
http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3118061.html
1.安装PCRE库
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38 && ./configure && make && make install
2.安装zlib库
cd /usr/local/
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz && cd zlib-1.2.8
./configure && make && make install
3.安装ssl
cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz && cd openssl-1.0.1c
./config && make && make install
4.安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:
cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz && cd nginx-1.2.8
./configure --prefix=/usr/local/nginx --with-pcre=/home/source/pcre-8.39 --with-zlib=/home/source/zlib-1.2.8 && make && make install
whereis nginx
--with-pcre=/usr/src/pcre-8.21 指的是pcre-8.21 的源码路径。
--with-zlib=/usr/src/zlib-1.2.7 指的是zlib-1.2.7 的源码路径。
编译器默认没有把宏定义扩展信息编译进二进制文件。
编译时需添加-gdwarf-2和-g3两个参数。
加了-g3的参数后,gcc编译的时候,会将扩展的debug 信息编译进二进制文件里面,包括宏定义信息。
结论:
user www; //这里要和php-fpm用同一个用户名 useradd www;groupadd -g www www worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /home/www; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root /home/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
为方便nginx启动,重启
touch /etc/init.d/nginx
chmod +x /etc/init.d/nginx
#!/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/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/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 $nginx_pid } # reload nginx service functions. 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
tar zvxf php-5.5.38.tar.gz && cd php-5.5.38
make all install
6.配置php-fpm
cd /usr/local/php
cp etc/php-fpm.conf.default etc/php-fpm.conf
vi etc/php-fpm.conf
修改
user = www-data
group = www-data
如果www-data用户不存在,那么先添加www-data用户
groupadd www-data
useradd -g www-data www-data
/usr/local/php/sbin/php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
-bash: /usr/bin/php: No such file or directory
vi /etc/profile
在文件底部增加一行配置
export PATH=/usr/local/php/bin:$PATH
保存退出
source /etc/profile
./configure --prefix=/usr/local/php --with-php-config=/usr/local/php/bin/php-config --enable-sockets
make && make install
master进程可以理解以下信号
INT, TERM 立刻终止 QUIT 平滑终止 USR1 重新打开日志文件 USR2 平滑重载所有worker进程并重新载入配置和二进制模块
示例:
php-fpm 关闭:
kill -INT `cat /usr/local/php/var/run/php-fpm.pid`
php-fpm 重启:
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
cd bison-2.6.4
./configure
make
sudo make install
# tar xf re2c-0.13.7.5.tar.gz
# cd re2c-0.13.7.5
# ./configure
#make && make install
php-fpm 5.4.7 如何关闭 重启?
查看php-fpm进程数:
ps aux | grep -c php-fpm
6 zend opcache
[opcache]
zend_extension = /data/app/php5/lib/php/extensions/no-debug-zts-20121212/opcache.so
opcache.enable=1
opcache.memory_consumption = 64
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
opcache.fast_shutdown = 1
opcache.enable_cli = 1
7.启动
确保系统的 80 端口没被其他程序占用,
/usr/local/nginx/sbin/nginx
检查是否启动成功:
netstat -ano|grep 80 有结果输入说明启动成功
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
7.重启
/usr/local/nginx/sbin/nginx –s reload
8.修改配置文件
cd /usr/local/nginx/conf
vi nginx.conf
9.常用配置
#nginx运行用户和组
user www www;
#启动进程,通常设置成和cpu的数量相等
worker_processes 4;
#全局错误日志及PID文件
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
#epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能
use epoll;
#单个后台worker process进程的最大并发链接数
worker_connections 10240;
}
#设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
include mime.types;
default_type application/octet-stream;
error_page 400 403 500 502 503 504 /50x.html;
index index.html index.shtml
autoindex off;
fastcgi_intercept_errors on;
sendfile on;
# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip off;
#gzip_static on;
#gzip_min_length 1k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_buffers 4 16k;
gzip_proxied any;
gzip_disable "MSIE [1-6].";
gzip_types text/plain text/html text/css application/x-javascript application/xml application/xml+rss text/javascript;
#gzip_vary on;
server_name_in_redirect off;
#设定负载均衡的服务器列表
upstream portals {
server 172.16.68.134:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.135:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.136:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.137:8082 max_fails=2 fail_timeout=30s;
}
#upstream overflow {
# server 10.248.6.34:8090 max_fails=2 fail_timeout=30s;
# server 10.248.6.45:8080 max_fails=2 fail_timeout=30s;
#}
server {
#侦听8080端口
listen 8080;
server_name 127.0.0.1;
#403、404页面重定向地址
error_page 403 = http://www.e100.cn/ebiz/other/217/403.html;
error_page 404 = http://www.e100.cn/ebiz/other/218/404.html;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
proxy_buffer_size 64k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 128k;
client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
#proxy_send_timeout 3m;
#proxy_read_timeout 3m;
#proxy_buffer_size 4k;
#proxy_buffers 4 32k;
proxy_set_header Host $http_host;
proxy_max_temp_file_size 0;
#proxy_hide_header Set-Cookie;
# if ($host != 'www.e100.cn' ) {
# rewrite ^/(.*)$ http://www.e100.cn/$1 permanent;
# }
location / {
deny all;
}
location ~ ^/resource/res/img/blue/space.gif {
proxy_pass http://tecopera;
}
location = / {
rewrite ^(.*)$ /ebiz/event/517.html last;
}
location = /ebiz/event/517.html {
add_header Vary Accept-Encoding;
root /data/web/html;
expires 10m;
}
location = /check.html {
root /usr/local/nginx/html/;
access_log off;
}
location = /50x.html {
root /usr/local/nginx/html/;
expires 1m;
access_log off;
}
location = /index.html {
add_header Vary Accept-Encoding;
#定义服务器的默认网站根目录位置
root /data/web/html/ebiz;
expires 10m;
}
#定义反向代理访问名称
location ~ ^/ecps-portal/* {
# expires 10m;
#重定向集群名称
proxy_pass http://portals;
#proxy_pass http://172.16.68.134:8082;
}
location ~ ^/fetionLogin/* {
# expires 10m;
proxy_pass http://portals;
#proxy_pass http://172.16.68.134:8082;
}
#location ~ ^/business/* {
# # expires 10m;
# proxy_pass http://172.16.68.132:8088;
# #proxy_pass http://172.16.68.134:8082;
#}
location ~ ^/rsmanager/* {
expires 10m;
root /data/web/;
#proxy_pass http://rsm;
}
#定义nginx处理的页面后缀
location ~* (.*).(jpg|gif|htm|html|png|js|css)$ {
root /data/web/html/;
#页面缓存时间为10分钟
expires 10m;
}
#设定查看Nginx状态的地址
location ~* ^/NginxStatus/ {
stub_status on;
access_log off;
allow 10.1.252.126;
allow 10.248.6.49;
allow 127.0.0.1;
deny all;
}
# error_page 405 =200 @405;
# location @405
# {
# proxy_pass http://10.248.6.45:8080;
# }
access_log /data/logs/nginx/access.log combined;
error_log /data/logs/nginx/error.log;
}
server {
listen 8082;
server_name _;
location = /check.html {
root /usr/local/nginx/html/;
access_log off;
}
}
server {
listen 8088;
server_name _;
location ~ ^/* {
root /data/web/b2bhtml/;
access_log off;
}
}
server {
listen 9082;
server_name _;
# location ~ ^/resource/* {
# expires 10m;
# root /data/web/html/;
# }
location / {
root /data/web/html/sysMaintain/;
if (!-f $request_filename) {
rewrite ^/(.*)$ /sysMaintain.html last;
}
}
}
}
首先要找到php-fpm.conf配置文件,查看pid的配置路径(不是安装路径),然后把下面对应的地方改掉才能正常执行。
[root@DO-SG-H1 ~]# ps aux | grep php-fpm
root 11799 0.0 0.0 103248 880 pts/0 S+ 13:51 0:00 grep --color php-fpm
root 11973 0.0 0.0 417748 964 ? Ss Jun01 0:20 php-fpm: master process (/etc/php-fpm.conf)
cat /etc/php-fpm.conf
看到
pid = /var/run/php-fpm/php-fpm.pid
php-fpm 启动:
/usr/local/php/sbin/php-fpm
php-fpm 关闭:
kill -INT `cat /var/run/php-fpm/php-fpm.pid`
php-fpm 重启:
kill -USR2 `cat /var/run/php-fpm/php-fpm.pid`
查看php-fpm进程数:
ps aux | grep -c php-fpm
=============================
[root@DO-SG-H1 ~]# find / -name 'php-fpm' -type d
/var/log/php-fpm
/var/run/php-fpm
用这个find命令查找出来的路径是不对的
which php
/usr/bin/php