Configuring PHP

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
sundaresh
Forum Newbie
Posts: 3
Joined: Wed Jan 08, 2014 10:57 pm

Configuring PHP

Post by sundaresh »

In my default php installation the echo with double quotes ", does'nt work, and the variable names are not substituted
with their values within the string, but single quotes with catenation operator works.How do I fix this problem ?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Configuring PHP

Post by requinix »

By fixing your code. Because I guarantee you it's not quite what you've said it is.

Exactly what code isn't working?
sundaresh
Forum Newbie
Posts: 3
Joined: Wed Jan 08, 2014 10:57 pm

Re: Configuring PHP

Post by sundaresh »

Here is my code, which I executed

$limit=5;
echo "<p> $limit </p>"; // This does'nt work
echo '<p>'.$limit.'</p>'; // This works

I had a whole web-page coded in double-quotes and it displayed blank;
but when I changed them all to single quotes the page is displaying properly.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Configuring PHP

Post by Christopher »

I have never heard of that happening. Does it happen on every page on this server? Or only on this page?
(#10850)
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Configuring PHP

Post by Celauran »

Also, you're saying the output is blank. Is error reporting enabled? Anything in the logs?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Configuring PHP

Post by requinix »

sundaresh wrote:Here is my code, which I executed

$limit=5;
echo "<p> $limit </p>"; // This does'nt work
echo '<p>'.$limit.'</p>'; // This works

I had a whole web-page coded in double-quotes and it displayed blank;
but when I changed them all to single quotes the page is displaying properly.
So if you execute that exact code, you get

Code: Select all

<p>  </p><p>5</p>
as output?
sundaresh
Forum Newbie
Posts: 3
Joined: Wed Jan 08, 2014 10:57 pm

Re: Configuring PHP

Post by sundaresh »

When I execute the first echo seperately I get a blank-page.
When I execute the second echo I get 5 displayed on my browser.
I have'nt tried executing php on the console so I do'nt know, the php output.But the final html file is a blank when
I seperately use the first echo and the html is alright when I use the second format of echo.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Configuring PHP

Post by requinix »

So how about copy/pasting the entire, unaltered, exact contents of the file you are executing that contains both the working and not-working examples? Then browse to the script, do a View Source, and copy/paste the entire, unaltered, exact HTML you see.
Post Reply