Solved

Weird SH error caused be broken PHP or bad programming ?

Posted on 2006-10-19
3
212 Views
Last Modified: 2006-11-26
Hi,

Years back i have written a large project in PHP3 wich was my first really big project (took over a year to develop). It was meant as a OOP project but because the prep took too long we had to hurry and coding isn't always like it should be. Since then there have been some code adaptations and insertions. In April we had a server crash and had to move to a new server & installation.. with this came PHP 5.0.4. After i made some small changes everything was back up & running.  Till last sunday. Totally out of the blue i cannot build my pages anymore and i'm getting the same error over and over, each time by another piece of code.

The error occurs when building our pages, exectuting the script from shell.
Our pages get build kinda like this:

function OpenTemplate(template) {
  fetch template from database;
  exec(template);
}

Main template:
OpenTemplate(x);
some php code
OpenTemplate(y);
some html code
OpenTemplate(z);
etc...

template X:
OpenTemplate(a);
OpenTemplate(b);

and so on..

The error is:
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 2: syntax error: unexpected end of file

It occurs on multiple lines.. i.e. :
 - when using $_SERVER['HTTP_POST'] in the templates
 - executing some faulty code:
    $this->column    = array();
    $this->column[1]->category = array();
    $this->column[1]->total = 0;
It will give an error on ->category or ->total when one is disabled.. when both enabled for execution it will generate the error just once.

Please help !
0
Comment
Question by:Tiele
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 17772681
Seems that you have ` ` commands in your script which are equal to system() so inbetween those ` ` there seem to be a " which is not closed. So the executed shell-command is not valid
The errors come from the shell not php. Do you have an error-handler which executes a shell-script (e.g. for logging, creating missing files ?)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
str_replace not working in php script 4 31
Is there a limit to how many inner joins you should use? 4 31
write screen output to text file 21 47
PHP Syntax Error 4 27
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question