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>
I've checked my apache error logs, and I see multiple messages like this:
client 108.162.246.190] PHP Notice: Undefined offset: 4 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 5 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 5 in /var/www/html/search.php on line 143
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 6 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 6 in /var/www/html/search.php on line 143
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 7 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 7 in /var/www/html/search.php on line 143
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 8 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 8 in /var/www/html/search.php on line 143
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 9 in /var/www/html/search.php on line 142
[Tue Dec 31 00:17:48 2013] [error] [client 108.162.246.190] PHP Notice: Undefined offset: 9 in /var/www/html/search.php on line 143
And code around 142-143 lines looks like this (the actual 142-143 lines are implode ones):
if ($nuorodoshut != NULL)
{
foreach ($nuorodoshut as $key => $nuorodahut)
{
$keywords = explode(' ', $qsvarus);
$title[$key] = preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '<b>$0</b>', $title[$key]);
$infoo[$key] = preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '<b>$0</b>', $infoo[$key]);
echo '<tr><td><h3>';
echo str_replace('<a href="/', '<a href="/host/', $nuorodahut->innertext) . '</h3>';
echo $aprasymashut[$key]->innertext . '<br>';
}
}
I just can't handle this error. Any help would be appreciated
The error messages are telling you that there's no $title[$key] and $infoo[$key] when $key is 5 - 9. If these two arrays should have all the same indexes as $nuorodoshut, then something is wrong in the creation of the arrays.
If it's OK that they shouldn't have these elements, you need to check this before you try using the values, e.g.
$title[$key] = isset($title[$key]) ? preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '<b>$0</b>', $title[$key]) : '';
$infoo[$key] = isset($infoo[$key]) ? preg_replace('/\b('.implode('|', $keywords).')\b(?![^<]*[>])/i', '<b>$0</b>', $infoo[$key]) : '';
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/
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
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?