failed (104: Connection reset by peer) - php

We are using the php5-fpm and nginx.
# nginx -v
nginx version: nginx/1.1.19
*
# php -v
PHP 5.3.27-1~dotdeb.0 with Suhosin-Patch (cli) (built: Jul 25 2013 19:30:39)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
*
Got the following error,
2013/08/21 20:00:20 [error] 12740#0: *46 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.17.7.12, server: fe.test.local, request: "GET /search?gender=female&ageFrom=20&ageTo=32&religionId=&casteId=&countryId=&heightFrom=&heightTo=&profileImageStatus=%28y+p%29&search=Search HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "fe.test.local", referrer: "http://fe.test.local/
PHP5-FPM configuration,
# grep ^[^\;] /etc/php5/fpm/php-fpm.conf
[global]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
log_level = notice
process_control_timeout = 30
include=/etc/php5/fpm/pool.d/*.conf
# grep ^[^\;] /etc/php5/fpm/pool.d/www.conf
[www]
listen = /var/run/php5-fpm.sock
listen.backlog = -1
user = www-data
group = www-data
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
rlimit_files = 131072
rlimit_core = unlimited
chdir = /
Nginx fascgi configuration part
location ~ \.php$
{
fastcgi_index index.php;
include fastcgi_params;
fastcgi_connect_timeout 120;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
client_max_body_size 20M;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# strace -f -s 8000 -p 12761
Process 12761 attached - interrupt to quit
epoll_wait(9, {}, 1, 944) = 0
epoll_wait(9, {}, 1, 1000) = 0
epoll_wait(9, {}, 1, 1000) = 0
epoll_wait(9, 269f530, 1, 1000) = -1 EINTR (Interrupted system call)
--- SIGCHLD (Child exited) # 0 (0) ---
write(6, "C", 1) = 1
rt_sigreturn(0x6) = -1 EINTR (Interrupted system call)
epoll_wait(9, {{EPOLLIN, {u32=15427040, u64=15427040}}}, 1, 122) = 1
read(4, "C", 1) = 1
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 127}], WNOHANG|WSTOPPED, NULL) = 12826
write(3, "[21-Aug-2013 19:33:37] WARNING: [pool www] child 12826 exited with code 127 after 275.844033 seconds from start\n", 112) = 112
clone(Process 12832 attached (waiting for parent)
Process 12832 resumed (parent 12761 ready)
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd7a31cfa10) = 12832
[pid 12832] set_robust_list(0x7fd7a31cfa20, 0x18) = 0
[pid 12832] dup2(1, 2) = 2
[pid 12832] close(3) = 0
[pid 12832] dup2(7, 0) = 0
[pid 12832] geteuid() = 0
[pid 12832] setrlimit(RLIMIT_NOFILE, {rlim_cur=128*1024, rlim_max=128*1024}) = 0
[pid 12832] setrlimit(RLIMIT_CORE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
[pid 12832] chdir("/") = 0
[pid 12832] setgid(33) = 0
[pid 12832] open("/proc/sys/kernel/ngroups_max", O_RDONLY) = 3
[pid 12832] read(3, "65536\n", 31) = 6
[pid 12832] close(3) = 0
[pid 12832] open("/etc/group", O_RDONLY|O_CLOEXEC) = 3
[pid 12832] lseek(3, 0, SEEK_CUR) = 0
[pid 12832] fstat(3, {st_mode=S_IFREG|0644, st_size=777, ...}) = 0
[pid 12832] mmap(NULL, 777, PROT_READ, MAP_SHARED, 3, 0) = 0x7fd7a31c1000
[pid 12832] lseek(3, 777, SEEK_SET) = 777
[pid 12832] fstat(3, {st_mode=S_IFREG|0644, st_size=777, ...}) = 0
[pid 12832] munmap(0x7fd7a31c1000, 777) = 0
[pid 12832] close(3) = 0
[pid 12832] setgroups(1, [33]) = 0
[pid 12832] setuid(33) = 0
[pid 12832] prctl(PR_SET_DUMPABLE, 1) = 0
[pid 12832] close(4) = 0
[pid 12832] close(6) = 0
[pid 12832] rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] rt_sigaction(SIGUSR1, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] rt_sigaction(SIGUSR2, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] rt_sigaction(SIGQUIT, {0x7633f0, [], SA_RESTORER|SA_RESTART, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12832] close(7) = 0
[pid 12832] accept(0,
[pid 12761] write(3, "[21-Aug-2013 19:33:37] NOTICE: [pool www] child 12832 started\n", 62) = 62
[pid 12761] wait4(-1, 0x7fff07258a7c, WNOHANG|WSTOPPED, NULL) = 0
[pid 12761] read(4, 0x7fff07258b5f, 1) = -1 EAGAIN (Resource temporarily unavailable)
[pid 12761] epoll_wait(9, {}, 1, 108) = 0
[pid 12761] epoll_wait(9, {}, 1, 1000) = 0
[pid 12761] epoll_wait(9, 269f530, 1, 1000) = -1 EINTR (Interrupted system call)
[pid 12761] --- SIGCHLD (Child exited) # 0 (0) ---
[pid 12761] write(6, "C", 1) = 1
[pid 12761] rt_sigreturn(0x6) = -1 EINTR (Interrupted system call)
[pid 12761] epoll_wait(9, {{EPOLLIN, {u32=15427040, u64=15427040}}}, 1, 769) = 1
[pid 12761] read(4, "C", 1) = 1
[pid 12761] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 127}], WNOHANG|WSTOPPED, NULL) = 12830
[pid 12761] write(3, "[21-Aug-2013 19:33:39] WARNING: [pool www] child 12830 exited with code 127 after 10.053632 seconds from start\n", 111) = 111
[pid 12761] clone(Process 12833 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd7a31cfa10) = 12833
[pid 12761] write(3, "[21-Aug-2013 19:33:39] NOTICE: [pool www] child 12833 started\n", 62) = 62
[pid 12761] wait4(-1, 0x7fff07258a7c, WNOHANG|WSTOPPED, NULL) = 0
[pid 12761] read(4, 0x7fff07258b5f, 1) = -1 EAGAIN (Resource temporarily unavailable)
[pid 12761] epoll_wait(9,
[pid 12833] set_robust_list(0x7fd7a31cfa20, 0x18) = 0
[pid 12833] dup2(1, 2) = 2
[pid 12833] close(3) = 0
[pid 12833] dup2(7, 0) = 0
[pid 12833] geteuid() = 0
[pid 12833] setrlimit(RLIMIT_NOFILE, {rlim_cur=128*1024, rlim_max=128*1024}) = 0
[pid 12833] setrlimit(RLIMIT_CORE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
[pid 12833] chdir("/") = 0
[pid 12833] setgid(33) = 0
[pid 12833] open("/proc/sys/kernel/ngroups_max", O_RDONLY) = 3
[pid 12833] read(3, "65536\n", 31) = 6
[pid 12833] close(3) = 0
[pid 12833] open("/etc/group", O_RDONLY|O_CLOEXEC) = 3
[pid 12833] lseek(3, 0, SEEK_CUR) = 0
[pid 12833] fstat(3, {st_mode=S_IFREG|0644, st_size=777, ...}) = 0
[pid 12833] mmap(NULL, 777, PROT_READ, MAP_SHARED, 3, 0) = 0x7fd7a31c1000
[pid 12833] lseek(3, 777, SEEK_SET) = 777
[pid 12833] fstat(3, {st_mode=S_IFREG|0644, st_size=777, ...}) = 0
[pid 12833] munmap(0x7fd7a31c1000, 777) = 0
[pid 12833] close(3) = 0
[pid 12833] setgroups(1, [33]) = 0
[pid 12833] setuid(33) = 0
[pid 12833] prctl(PR_SET_DUMPABLE, 1) = 0
[pid 12833] close(4) = 0
[pid 12833] close(6) = 0
[pid 12833] rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] rt_sigaction(SIGUSR1, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] rt_sigaction(SIGUSR2, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] rt_sigaction(SIGQUIT, {0x7633f0, [], SA_RESTORER|SA_RESTART, 0x7fd7a02234a0}, NULL, 8) = 0
[pid 12833] close(7) = 0
[pid 12833] accept(0,
[pid 12761] {}, 1, 766) = 0
[pid 12761] epoll_wait(9, {}, 1, 1000) = 0`enter code here`
[pid 12761] epoll_wait(9, {}, 1, 1000) = 0

The above nginx error indicate that issue is related to the fastcgi(php-fpm).
After enabling the "catch_workers_output" on /etc/php5/fpm/pool.d/www.conf
Got the relevant error on php5-fpm.log. Now understand that issue is related to AMQP module.
[21-Aug-2013 23:32:57] WARNING: [pool www] child 16091 said into stderr: "php-fpm: pool www: symbol lookup error: /usr/lib/php5/20090626/amqp.so: undefined symbol: amqp_open_socket"
Issue has been fixed afterrecompiled and install amqp module

Related

Why my Drupal is intermittently slow? Stracing shows a lot of repeated sendto calls

One of the Drupal sites I manage occasionally loads very slowly. If I strace PHP-FPM while this happens, I see a lot of poll/recvfrom/sendto system calls with what appears to be the same content:
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24589, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\207\2\0\0\3INSERT INTO menu_router\n "..., 651, MSG_DONTWAIT, NULL, 0) = 651
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24578, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\\\2\0\0\3INSERT INTO menu_router\n "..., 608, MSG_DONTWAIT, NULL, 0) = 608
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24567, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "T\2\0\0\3INSERT INTO menu_router\n "..., 600, MSG_DONTWAIT, NULL, 0) = 600
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24556, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "2\2\0\0\3INSERT INTO menu_router\n "..., 566, MSG_DONTWAIT, NULL, 0) = 566
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24545, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\37\2\0\0\3INSERT INTO menu_router\n "..., 547, MSG_DONTWAIT, NULL, 0) = 547
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24534, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\r\2\0\0\3INSERT INTO menu_router\n "..., 529, MSG_DONTWAIT, NULL, 0) = 529
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24523, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "B\2\0\0\3INSERT INTO menu_router\n "..., 582, MSG_DONTWAIT, NULL, 0) = 582
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24512, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, ":\2\0\0\3INSERT INTO menu_router\n "..., 574, MSG_DONTWAIT, NULL, 0) = 574
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24501, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "(\2\0\0\3INSERT INTO menu_router\n "..., 556, MSG_DONTWAIT, NULL, 0) = 556
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24490, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "4\2\0\0\3INSERT INTO menu_router\n "..., 568, MSG_DONTWAIT, NULL, 0) = 568
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24479, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "(\2\0\0\3INSERT INTO menu_router\n "..., 556, MSG_DONTWAIT, NULL, 0) = 556
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24468, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, " \2\0\0\3INSERT INTO menu_router\n "..., 548, MSG_DONTWAIT, NULL, 0) = 548
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24457, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, ",\2\0\0\3INSERT INTO menu_router\n "..., 560, MSG_DONTWAIT, NULL, 0) = 560
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24446, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\30\2\0\0\3INSERT INTO menu_router\n "..., 540, MSG_DONTWAIT, NULL, 0) = 540
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24435, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "6\2\0\0\3INSERT INTO menu_router\n "..., 570, MSG_DONTWAIT, NULL, 0) = 570
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24424, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\253\2\0\0\3INSERT INTO menu_router\n "..., 687, MSG_DONTWAIT, NULL, 0) = 687
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24413, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\206\6\0\0\3INSERT INTO menu_router\n "..., 1674, MSG_DONTWAIT, NULL, 0) = 1674
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24402, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "!\2\0\0\3INSERT INTO menu_router\n "..., 549, MSG_DONTWAIT, NULL, 0) = 549
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24391, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "3\2\0\0\3INSERT INTO menu_router\n "..., 567, MSG_DONTWAIT, NULL, 0) = 567
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24380, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "$\2\0\0\3INSERT INTO menu_router\n "..., 552, MSG_DONTWAIT, NULL, 0) = 552
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24369, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "*\2\0\0\3INSERT INTO menu_router\n "..., 558, MSG_DONTWAIT, NULL, 0) = 558
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24358, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "9\2\0\0\3INSERT INTO menu_router\n "..., 573, MSG_DONTWAIT, NULL, 0) = 573
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24347, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "*\2\0\0\3INSERT INTO menu_router\n "..., 558, MSG_DONTWAIT, NULL, 0) = 558
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24336, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "-\2\0\0\3INSERT INTO menu_router\n "..., 561, MSG_DONTWAIT, NULL, 0) = 561
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24325, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\33\2\0\0\3INSERT INTO menu_router\n "..., 543, MSG_DONTWAIT, NULL, 0) = 543
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1 ([{fd=5, revents=POLLIN}])
[pid 27381] recvfrom(5, "\7\0\0\1\0\1\0\2\0\0\0", 24314, MSG_DONTWAIT, NULL, NULL) = 11
[pid 27381] sendto(5, "\6\2\0\0\3INSERT INTO menu_router\n "..., 522, MSG_DONTWAIT, NULL, 0) = 522
[pid 27381] poll([{fd=5, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928 <unfinished ...>
All of timeouts are reasonable so I don't think that's the issue. Since the server configuration is identical to my other sites, I think it's a code issue, but I'm not sure what in PHP can cause this.
It's Drupal 6.28 and PHP 5.5.20.
Your recvfrom/sendto are just MySQL queries, so it's nothing wrong with it.
Inserting into menu_router table indicates that Drupal is rebuilding this table (see: menu_rebuild() API);
This function will clear and populate the {menu_router} table, add entries
to {menu_links} for new router items, and then remove stale items from
{menu_links}.
This is either triggered by menu_rebuild_needed variable (if set), or by external modules (such as Devel), or simply in your theme settings you've enabled 'Rebuild theme registry on every page.' option.
Usually rebuilding menu is one-time process on clear cache. If above suggestions won't help, you need to check which module/code exactly calling menu_rebuild() (in includes/menu.inc) by placing there breakpoint and printing backtrace.
One way of doing (if Devel is present), is using dd(), e.g.
function menu_rebuild() {
dd(debug_backtrace()); // Adding temporary debug line.
Then check your /tmp/drupal_debug.txt file for backtrace details.

PHP Merging files not working

Merging files isn't working anymore and I'm not sure why. I'm not getting any on-screen errors so I checked my error log and this is what I see:
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/phplib/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Warning: Invalid argument supplied for foreach() in /home/toolplas/public_html/main/phplib/edit_workorder.php on line 50, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Stack trace:, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/phplib/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Notice: Undefined index: affect in /home/toolplas/public_html/main/phplib/edit_workorder.php on line 80, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Stack trace:, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/phplib/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Notice: Undefined index: file in /home/toolplas/public_html/main/phplib/edit_workorder.php on line 282, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Stack trace:, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/phplib/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Warning: Invalid argument supplied for foreach() in /home/toolplas/public_html/main/phplib/edit_workorder.php on line 282, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Stack trace:, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/phplib/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /home/toolplas/public_html/main/edit_workorder.php on line 176, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP Stack trace:, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
[Tue Mar 18 09:06:08 2014] [error] [client 10.0.50.12] PHP 1. {main}() /home/toolplas/public_html/main/edit_workorder.php:0, referer: https://new.tps.com/edit_workorder.php?job_num=1000&id=4173
Its not specific to one Work Order as its happening to all of them and I'm not sure why its no longer working.
Here's the code:
if(isset($wo['files_to_merge'])){
//$prev_files = $_POST['file'];
//$files = $_FILES['file'];
$folder = "/home/toolplas/public_html/main/pdf/temp/WO$wo_id/";
if(!file_exists($folder)){
mkdir($folder);
}
$files = array();
if(isset($_POST['file'])){
foreach($_POST['file'] as $key => $item){
$files[] = array('order' => $key, 'filename' => $item);
}
}
/*foreach($_FILES['file']['name'] as $key => $item){
$name = date('U') . preg_replace('/[^\w\._]+/', '', basename($item));
if(move_uploaded_file($_FILES['file']['tmp_name'][$key], $folder . $name)){
$files[] = array('order' => $key, 'filename' => $name);
} else {
debug('File Not Uploaded ' . $name);
}
}*/
foreach($_FILES['file']['error'] as $key => $error){
$tmp_name= $_FILES['file']['tmp_name'][$key];
$name = date('U') . preg_replace('/[^\w\._]+/', '', basename($_FILES['file']['name'][$key]));
if($error == UPLOAD_ERR_OK){
move_uploaded_file($tmp_name, $folder . $name);
$files[] = array('order' => $key, 'filename' => $name);
} else {
debug("Cannot Move File: $tmp_name -> $name");
debug("File Error: $error");
}
}
$sql = "DELETE FROM workorder_files WHERE workorder_id = $wo_id;";
echo $sql;
mysqli_query($dbc3, $sql) or die("Query 11: " . mysqli_error($dbc3));
foreach($files as $file){
$sql = "INSERT INTO workorder_files(workorder_id, filename, `order`) VALUES($wo_id, '" . $file['filename'] . "', " . $file['order'] . ");";
mysqli_query($dbc3, $sql) or die("Query 12: " . mysqli_error($dbc3));
}
//print_r($_FILES);
}
Employees told me it was working fine Friday and over the weekend.
This is what the form looks like,
HTML:
<tr>
<th>Files To Merge?</th>
<td><input type="checkbox" class='files_to_merge' id="files_to_merge" name='workorder[files_to_merge]' {% if files is not empty %}checked='checked'{% endif %} />{{ functions.alert('More to the right') }}</td>
</tr>
<tr>
<th>Posted By</th>
<td>{{ user.name }}<input readonly="readonly" type="hidden" name="workorder[user]" value="{{ user.id }}" /></td>
</tr>

Unable to send email using PHP Pear

I tried to send email using pear. Here is my code
<?php
require_once "/usr/share/pear/Mail.php";
require_once "/usr/share/pear/Mail/mime.php";
$to = "Info <info#mydomain.com>";
$subject = "Contact Form - mydomain.com\r\n\r\n";
$host = "smtp.zoho.com";
$username = "noreply#mydomain.com";
$password = "abc#123";
$port = "465";
//Sender Details
$sender_name = $_POST['name'];
$from = $_POST['name']." <".$_POST['email'].">";
$sender_phone = $_POST['phone'];
//Create Message
$body = $_POST['message'];
//$body = wordwrap($body, 70, "\r\n");
$body = $body . "\r\n" . "Phone: " .$sender_phone;
if($sender_name != "" && $_POST['email'] != "" && $body != "" && $sender_phone != "")
{
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'Reply-To: ' => $from);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
header("Location:contact-us.php?mcode=1");
}
}
else
{
header("Location:contact-us.php?mcode=2");
}
?>
Now this code gives me the following error in browser:
When I checked my php error_log i found this:
[Tue Dec 17 08:46:56 2013] [notice] child pid 7416 exit signal Segmentation fault (11)
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Notice: Undefined index: name in /var/www/html/contact-us-process.php on line 14
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Stack trace:
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP 1. {main}() /var/www/html/contact-us-process.php:0
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Notice: Undefined index: name in /var/www/html/contact-us-process.php on line 15
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Stack trace:
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP 1. {main}() /var/www/html/contact-us-process.php:0
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Notice: Undefined index: email in /var/www/html/contact-us-process.php on line 15
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Stack trace:
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP 1. {main}() /var/www/html/contact-us-process.php:0
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Notice: Undefined index: phone in /var/www/html/contact-us-process.php on line 16
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Stack trace:
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP 1. {main}() /var/www/html/contact-us-process.php:0
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Notice: Undefined index: message in /var/www/html/contact-us-process.php on line 19
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP Stack trace:
[Tue Dec 17 08:47:44 2013] [error] [client 117.198.137.57] PHP 1. {main}() /var/www/html/contact-us-process.php:0
[Tue Dec 17 08:47:45 2013] [notice] child pid 6887 exit signal Segmentation fault (11)
[Tue Dec 17 08:50:26 2013] [notice] child pid 7414 exit signal Segmentation fault (11)
[Tue Dec 17 09:35:48 2013] [error] [client 117.198.124.73] File does not exist: /var/www/html/favicon.ico
[Tue Dec 17 09:39:46 2013] [notice] child pid 8617 exit signal Segmentation fault (11)
I am using Rackspace cloud with Zoho email system.
When I did:
[root#mydomain /]# find -name Mail.php
./usr/share/pear/Mail.php
Thats why I directly included it in php file,
Also when I did,
[root#mydomain /]# find -name mime.php
./usr/share/pear/Mail/mime.php
So I used require_once "/usr/share/pear/Mail/mime.php", However this was there in an example, I am not so sure why I used this line.
What could be the possible reason for this and how i can solve it ?
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "mail.example.com"; // SMTP server example
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "username"; // SMTP account username example
$mail->Password = "password"; // SMTP account password example
You can find more about PHPMailer here: https://code.google.com/a/apache-extras.org/p/phpmailer/

php error_log weirdness

i have a global variable debug_smart404 in my smart404.php code:
$debug_smart404 = intval(get_option('debug_smart404' ));
error_log("smart404_redirect: debug_smart404 =" . ( $debug_smart404 ) );
which i use numerous places:
if ( $debug_smart404 > 4 ) # lotsa debug!
{
error_log("smart404_redirect: take_1st_match=" . ( $take_1st_match ? "yes" : "no" ) );
error_log("smart404_redirect: take_exact_match=" . ( $take_exact_match ? "yes" : "no" ) );
error_log("smart404_redirect: search_whole_uri=" . ( $search_whole_uri ? "yes" : "no" ) );
error_log("smart404_redirect: walk_uri=" . ( $walk_uri ? "yes" : "no" ) );
error_log("smart404_redirect: ignored_patterns_input=" . $patterns );
error_log("smart404_redirect: ignored_patterns_array=" . join($patterns_array,",") );
error_log("smart404_redirect: search_groups=" . join($search_groups,","));
}
while ( TRUE )
{
error_log("smart404_redirect:inside while: debug_smart404 =" . ( $debug_smart404 ) );
...
if ( $debug_smart404 > 3 ) # less debug
{
error_log("smart404_redirect: search_words=" . $search_words);
}
...
if ( $debug_smart404 > 0 ) {
error_log("smart404_redirect: uri=" . $uri . "= #matches=" . $mct);
}
...
} #end while...
so when i set debug_smart404 == 5, i get the expected output for the instances outside the while:
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: debug_smart404 =5
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_1st_match=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_exact_match=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_whole_uri=no
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: walk_uri=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: ignored_patterns_input=wp-.*\r\n(ing|s|er|est)$\r\nprivate/.*
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: ignored_patterns_array=#wp-.*#i,#(ing|s|er|est)$#i,#private/.*#i,#/(trackback|feed|(comment-)?page-?[0-9]*)/?$#i,#\\.(html|php)$#i,#/?\\?.*#i
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_groups=pages,posts,categories
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect:inside while: debug_smart404 =5
but note that the error_log output inside the while loop's if statements is missing...but only on my production server (a netsol vps)
it works fine on my test server (lighttpd):
2013-03-14 08:26:40: (mod_fastcgi.c.2711) FastCGI-stderr: smart404_redirect: debug_smart404 =5
smart404_redirect: take_1st_match=no
smart404_redirect: take_exact_match=no
smart404_redirect: search_whole_uri=yes
smart404_redirect: walk_uri=yes
smart404_redirect: ignored_patterns_input=wp-.*
(ing|s|er|est)$
private/.*
smart404_redirect: ignored_patterns_array=#wp-.*#i,#(ing|s|er|est)$#i,#private/.*#i,#/(trackback|feed|(comment-)?page-?[0-9]*)/?$#i,#\.(html|php)$#i,#/?\?.*#i
smart404_redirect: search_groups=pages,posts,categories
smart404_redirect:inside while: debug_smart404 =5
smart404_redirect: search_words=cavitronix.com xxx zzzxxxx
smart404_redirect: uri=/cavitronix.com//xxx/zzzxxxx= #matches=0
wtf??? running php5 on both, and it used to work on vps (debug=1 output here)-:
[Thu Mar 14 06:32:55 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/how-it-works= #matches=1
[Thu Mar 14 06:41:32 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/videos/e2c-overview/private/awstats/current/new.html= #matches=10
[Thu Mar 14 06:53:38 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/current/previous.html= #matches=3
[Thu Mar 14 06:54:47 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/press-releases= #matches=3
or is this some feature of netsol's vps hackery?
The error log inside the while IS printed; your own paste of the error log from production server shows it "inside while: debug_smart404 =5"
You have missed a lot of code behind that '...'. Is it possible that your code gets inside the while loop, but then (on production) either quickly breaks out/or continues, BEFORE it reaches the other error log statements. Can you rule that out positively?

file_get_contents fails on debian (lenny) server

Not sure if it's because it's out of life, but it has been running a website and working until very recently (1 week) - the server hasn't been updated, so am not sure what happened to break the script.
Here's a test script that I've been running (and fails) on the debian server:
<?php
$url = "http://www.andyloughran.co.uk/test.html";
echo $url."\n";
$test = file_get_contents($url);
echo $test;
That should normally return 'ndy test' or something similar.
However, on the debian box it's just timing out.
I've checked and I can wget the file:
<?php
exec('wget http://www.andyloughran.co.uk/test.html');
so am not sure what is it in file_get_contents that isn't working.
I've checked and allow_fopen_url is set to On.
I could do with advice not just on fixing this problem, but working out how to debug the php in order to be able to identify the problem myself in the future.
Curl is not really an option at the moment, as I'm more interested in working out why it's stopped working, rather than an alternative.
Thanks!
Here's the strace error:
open("/dev/urandom", O_RDONLY) = 3
read(3, "\202\231\320\206"..., 4) = 4
close(3) = 0
open("/dev/urandom", O_RDONLY) = 3
read(3, "cdO\37"..., 4) = 4
close(3) = 0
brk(0x9133000) = 0x9133000
open("http_test.php", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=187, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7837000
read(3, "<?php\n\nini_set('display_errors', "..., 4096) = 187
_llseek(3, 0, [0], SEEK_SET) = 0
time(NULL) = 1348748612
fstat64(0, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
fstat64(0, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7836000
_llseek(0, 0, 0xbfae579c, SEEK_CUR) = -1 ESPIPE (Illegal seek)
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7835000
_llseek(1, 0, 0xbfae579c, SEEK_CUR) = -1 ESPIPE (Illegal seek)
fstat64(2, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
_llseek(2, 0, 0xbfae579c, SEEK_CUR) = -1 ESPIPE (Illegal seek)
getcwd("/root"..., 4096) = 6
time(NULL) = 1348748612
lstat64("/root", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/root/http_test.php", {st_mode=S_IFREG|0644, st_size=187, ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfae3798) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "<?php\n\nini_set('display_errors', "..., 8192) = 187
read(3, ""..., 4096) = 0
read(3, ""..., 8192) = 0
close(3) = 0
munmap(0xb7837000, 4096) = 0
write(1, "http://www.andyloughran.co.uk/tes"..., 40http://www.andyloughran.co.uk/test.html
) = 40
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 3
close(3) = 0
socket(PF_NETLINK, SOCK_RAW, 0) = 3
bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
getsockname(3, {sa_family=AF_NETLINK, pid=28901, groups=00000000}, [12]) = 0
time(NULL) = 1348748612
sendto(3, "\24\0\0\0\26\0\1\3DEdP\0\0\0\0\0\0\0\0"..., 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"0\0\0\0\24\0\2\0DEdP\345p\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1\10"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 156
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"#\0\0\0\24\0\2\0DEdP\345p\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0DEdP\345p\0\0\0\0\0\0\1\0\0\0\24\0\1\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 20
close(3) = 0
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=95, ...}) = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=141, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7837000
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 141
read(3, ""..., 4096) = 0
close(3) = 0
munmap(0xb7837000, 4096) = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=141, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7837000
read(3, "127.0.0.1 localhost.localdomain l"..., 4096) = 141
read(3, ""..., 4096) = 0
close(3) = 0
munmap(0xb7837000, 4096) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=32850, ...}) = 0
mmap2(NULL, 32850, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7820000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libnss_dns.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220\v\0\0004\0\0\0x"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=17880, ...}) = 0
mmap2(NULL, 20616, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xca5000
mmap2(0xca9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3) = 0xca9000
close(3) = 0
munmap(0xb7820000, 32850) = 0
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=95, ...}) = 0
gettimeofday({1348748612, 441933}, NULL) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 28) = 0
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1348748612, 442194}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "2k\1\0\0\1\0\0\0\0\0\0\3www\fandyloughran\2co\2"..., 40, MSG_NOSIGNAL) = 40
poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [102]) = 0
recvfrom(3, "2k\201\200\0\1\0\0\0\1\0\0\3www\fandyloughran\2co\2"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 102
close(3) = 0
gettimeofday({1348748612, 755352}, NULL) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 28) = 0
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1348748612, 755589}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\312-\1\0\0\1\0\0\0\0\0\0\3www\fandyloughran\2co\2"..., 56, MSG_NOSIGNAL) = 56
poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [121]) = 0
recvfrom(3, "\312-\201\203\0\1\0\0\0\1\0\0\3www\fandyloughran\2co\2"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 121
close(3) = 0
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=95, ...}) = 0
gettimeofday({1348748613, 222946}, NULL) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 28) = 0
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1348748613, 223253}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\254Q\1\0\0\1\0\0\0\0\0\0\3www\fandyloughran\2co\2"..., 40, MSG_NOSIGNAL) = 40
poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [56]) = 0
recvfrom(3, "\254Q\201\200\0\1\0\1\0\0\0\0\3www\fandyloughran\2co\2"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 56
close(3) = 0
gettimeofday({1348748613, 400717}, NULL) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("85.119.82.243")}, 16) = -1 EINPROGRESS (Operation now in progress)
poll([{fd=3, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=3, revents=POLLOUT}])
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
fcntl64(3, F_SETFL, O_RDWR) = 0
send(3, "GET /test.html HTTP/1.0\r\n"..., 25, MSG_DONTWAIT) = 25
send(3, "Host: www.andyloughran.co.uk\r\n"..., 30, MSG_DONTWAIT) = 30
send(3, "User-Agent: PHP\r\n"..., 17, MSG_DONTWAIT) = 17
send(3, "\r\n"..., 2, MSG_DONTWAIT) = 2
poll([{fd=3, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 60000^C <unfinished ...>
allow_url_fopen = On in php.ini
Check your DNS, ping www.andyloughran.co.uk
Throw the server out of the nearest window.
I had the same problemn a while ago. It was a DNS problem. Restarting the Webserver helped.
file_get_contents won't work with a URI.
Just try this:
$Stuff = file_get_contents($_SERVER['DOCUMENT_ROOT']."path/filename");
file_get_contents will be happy to "see" a local and accessible path. It will present you the file contents as a kind of "function-thank-you" ;)

Categories