试了一下,解决不了。 当客户端浏览器访问各种PHP脚本时,随机出现的错误也在我自己的程序中,当我试图从PHP脚本中提取内容时,有时会引发exception。 有时它运作良好,有时不。
几个月前,一切都运行良好。
一个好的灵魂可以缓慢地通过一系列debugging步骤吗? 我是Linux的新手。
htop截图现在没什么不寻常的:
1 [| 0.2%] 5 [ 0.0%] 2 [ 0.0%] 6 [ 0.0%] 3 [ 0.0%] 7 [ 0.0%] 4 [|| 0.5%] 8 [|| 0.7%] Mem[|||||||||||||||||||||||||5363/32087MB] Tasks: 57, 27 thr; 1 running Swp[|| 632/16375MB] Load average: 0.04 0.07 0.13 Uptime: 57 days, 22:41:20 PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 468 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 0:06.91 /usr/sbin/mysqld 3742 root 20 0 26020 2368 1444 R 0.2 0.0 0:00.09 htop 1235 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 104h /usr/sbin/mysqld 3745 root 20 0 101M 3968 2900 S 0.2 0.0 0:00.03 sshd: [accepted] 851 root 20 0 545M 291M 7936 S 0.0 0.9 1:56.57 php /home/***/fr/fetcher.php 1 root 20 0 34032 2188 1084 S 0.0 0.0 0:47.96 /sbin/init 996 syslog 20 0 250M 22444 820 S 0.0 0.1 2:27.11 rsyslogd 1402 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 4:11.39 /usr/sbin/mysqld 430 root 20 0 20004 492 492 S 0.0 0.0 0:00.13 upstart-udev-bridge --daemon 440 root 20 0 51344 712 712 S 0.0 0.0 0:00.03 /lib/systemd/systemd-udevd --dae 608 root 20 0 15260 368 368 S 0.0 0.0 0:00.08 upstart-socket-bridge --daemon 849 root 20 0 59640 1444 1088 S 0.0 0.0 0:00.00 CRON 850 root 20 0 4444 648 548 S 0.0 0.0 0:00.00 /bin/sh -c php /home/***/fr/fe 856 root 20 0 59640 1044 1040 S 0.0 0.0 0:00.00 CRON 858 root 20 0 4444 460 456 S 0.0 0.0 0:00.00 /bin/sh -c php /home/***/updat 860 root 20 0 341M 5676 3580 S 0.0 0.0 1:43.45 php /home/***/updater/index.ph 931 root 20 0 15276 376 376 S 0.0 0.0 0:00.06 upstart-file-bridge --daemon 965 messagebu 20 0 39216 1000 808 S 0.0 0.0 0:00.47 dbus-daemon --system --fork 997 syslog 20 0 250M 22444 820 S 0.0 0.1 0:00.02 rsyslogd 998 syslog 20 0 250M 22444 820 S 0.0 0.1 2:06.88 rsyslogd 995 syslog 20 0 250M 22444 820 S 0.0 0.1 4:34.06 rsyslogd 1014 root 20 0 43452 1408 1232 S 0.0 0.0 0:00.60 /lib/systemd/systemd-logind 1043 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty4 1045 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty5 1054 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty2 1055 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty3 1058 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty6 1074 root 20 0 4368 388 388 S 0.0 0.0 0:00.02 acpid -c /etc/acpi/events -s /va 1160 root 20 0 23656 724 640 S 0.0 0.0 0:14.16 cron 1161 daemon 20 0 19140 172 172 S 0.0 0.0 0:00.03 atd 1313 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.18 /usr/sbin/mysqld 1314 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:35.50 /usr/sbin/mysqld 1315 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.36 /usr/sbin/mysqld 1316 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.77 /usr/sbin/mysqld 1317 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.93 /usr/sbin/mysqld 1318 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.12 /usr/sbin/mysqld 1319 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.22 /usr/sbin/mysqld F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
/etc/apache2/apache2.conf的内容。 这个目录中还有许多其他的* .conf文件。
Mutex file:${APACHE_LOCK_DIR} default # # PidFile: The file in which the server should record its process # identification number when it starts. # This needs to be set in /etc/apache2/envvars # PidFile ${APACHE_PID_FILE} # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 5 # These need to be set in /etc/apache2/envvars User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} HostnameLookups Off ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn # Include module configuration: IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Include ports.conf <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /var/www/> Options FollowSymLinks AllowOverride None Require all granted </Directory> AccessFileName .htaccess <FilesMatch "^\.ht"> Require all denied </FilesMatch> LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent # Include of directories ignores editors' and dpkg's backup files, # see README.Debian for details. # Include generic snippets of statements IncludeOptional conf-enabled/*.conf # Include the virtual host configurations: IncludeOptional sites-enabled/*.conf # vim: syntax=apache ts=4 sw=4 sts=4 sr noet # Include phpmyadmin Include /etc/phpmyadmin/apache.conf ServerName localhost <VirtualHost *:80> ServerAdmin info@***.com DocumentRoot "/var/www/html" ServerName ***.***.com ServerAlias ***.***.com ErrorLog "logs/***/error_log" CustomLog "logs/***/access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin info@***.com DocumentRoot "/var/www/***" ServerName ***.com ServerAlias www.***.com ErrorLog "logs/***/error_log" CustomLog "logs/***/access_log" common </VirtualHost>
这听起来有点像你的服务器偶尔会耗尽资源,因此无法回应。
一个简单的方法来查看是否是这种情况是安装( sudo apt-get install htop )并运行一个名为htop的Linux程序。
它将向您显示正在使用多lessCPU和RAM,然后列出已打开的进程(程序)。 你可以通过不同的列对列表进行sorting,看看哪些正在占用资源。
顺便说一下,这是一个很好的方法来检查你正在使用什么types的程序,例如,如果你看到任何command称为httpd或/usr/sbin/httpd或类似的,你知道你使用的Apache作为一个Web服务器。
而且由于htop是一个只读程序,你不能通过使用它来破坏任何东西。
我有充分的理由相信这个问题与我的服务器没有任何关系,但是通过我的个人笔记本电脑上的互联网连接访问服务器。 我使用沃达丰提供的移动Wi-Fi设备连接到互联网(将4G转换为WiFi)。 沃达丰服务器以某种方式甚至在我的服务器上超时之前发送此错误消息。 他们也为其他服务器这样做。 使用不同的互联网连接的其他人在处理我的服务器时不会收到网关超时错误。