Solved

Weird SH error caused be broken PHP or bad programming ?

Posted on 2006-10-19
3
210 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now