Please help a newbie - PHP is running, but code is not executed
Please help a newbie - PHP is running, but code is not executed
am 15.01.2008 22:14:27 von Alan Silver
Hello,
I hope someone will be able to help me on this. I am not very
experienced with PHP, doing ASP.NET normally. I have a requirement to
use a third-party set of PHP pages on a site, and it's not running
properly. I don't think the problem is with the pages though, I think
PHP might not be running correctly.
The server is Windows 2003 Server with IIS and all the latest patches,
service packs, etc. I have PHP 5.2.3 running, and if I create a small
PHP page with just
in it, I get the expected information. This implies that PHP is running
OK. I have tried a couple of other basic PHP scripts, and they seem to
run OK as well. I went through the examples in the "simple tutorial" at
www.php.net and got exactly the results predicted.
However, if I try to run the pages I'm supposed to be installing, PHP
doesn't run. The code in the file is sent to the browser as plain text.
If I view the source of the page, I can see some (although not all) of
the PHP code in there. If I rename the PHP to have a .html extension, it
looks exactly the same. This sounds like the page is not being executed.
For example, there is code like this in the page...
The browser shows a text box with =$CFG_db_user?> inside. Obviously
the code isn't being executed.
Does anyone have a clue what is going on here? I realise it may be hard
without seeing the page, but it's not currently on a production server.
If there's any more info I can supply, please let me know.
TIA
--
Alan Silver
(anything added below this line is nothing to do with me)
Re: Please help a newbie - PHP is running, but code is not executed
am 15.01.2008 22:29:36 von Paul Lautman
Alan Silver wrote:
> Hello,
>
> I hope someone will be able to help me on this. I am not very
> experienced with PHP, doing ASP.NET normally. I have a requirement to
> use a third-party set of PHP pages on a site, and it's not running
> properly. I don't think the problem is with the pages though, I think
> PHP might not be running correctly.
>
> The server is Windows 2003 Server with IIS and all the latest patches,
> service packs, etc. I have PHP 5.2.3 running, and if I create a small
> PHP page with just
>
>
>
> in it, I get the expected information. This implies that PHP is
> running OK. I have tried a couple of other basic PHP scripts, and
> they seem to run OK as well. I went through the examples in the
> "simple tutorial" at www.php.net and got exactly the results
> predicted.
> However, if I try to run the pages I'm supposed to be installing, PHP
> doesn't run. The code in the file is sent to the browser as plain
> text. If I view the source of the page, I can see some (although not
> all) of the PHP code in there. If I rename the PHP to have a .html
> extension, it looks exactly the same. This sounds like the page is
> not being executed.
> For example, there is code like this in the page...
>
>
>
> The browser shows a text box with =$CFG_db_user?> inside. Obviously
> the code isn't being executed.
>
> Does anyone have a clue what is going on here? I realise it may be
> hard without seeing the page, but it's not currently on a production
> server.
> If there's any more info I can supply, please let me know.
>
> TIA
He he, I could maybe use your help as I am having to do a few asp/MSSQL
pages and my experience is php/MySQL.
Anyway, your problem is that is what is called a "short open tag" and in
the more recent releases of php their use is disabled by default.
So instead of =$CFG_db_user?> use
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 01:59:15 von Jerry Stuckle
Alan Silver wrote:
> Hello,
>
> I hope someone will be able to help me on this. I am not very
> experienced with PHP, doing ASP.NET normally. I have a requirement to
> use a third-party set of PHP pages on a site, and it's not running
> properly. I don't think the problem is with the pages though, I think
> PHP might not be running correctly.
>
> The server is Windows 2003 Server with IIS and all the latest patches,
> service packs, etc. I have PHP 5.2.3 running, and if I create a small
> PHP page with just
>
>
>
> in it, I get the expected information. This implies that PHP is running
> OK. I have tried a couple of other basic PHP scripts, and they seem to
> run OK as well. I went through the examples in the "simple tutorial" at
> www.php.net and got exactly the results predicted.
>
> However, if I try to run the pages I'm supposed to be installing, PHP
> doesn't run. The code in the file is sent to the browser as plain text.
> If I view the source of the page, I can see some (although not all) of
> the PHP code in there. If I rename the PHP to have a .html extension, it
> looks exactly the same. This sounds like the page is not being executed.
>
> For example, there is code like this in the page...
>
>
>
> The browser shows a text box with =$CFG_db_user?> inside. Obviously
> the code isn't being executed.
>
> Does anyone have a clue what is going on here? I realise it may be hard
> without seeing the page, but it's not currently on a production server.
>
> If there's any more info I can supply, please let me know.
>
> TIA
>
Paul gave you the reason. Now you should take this back to whomever
wrote that junk and make them fix it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 10:45:27 von Toby A Inkster
Paul Lautman wrote:
> Anyway, your problem is that is what is called a "short open tag" and
> in the more recent releases of php their use is disabled by default.
>
> So instead of =$CFG_db_user?> use
Or (less work for you) find php.ini and switch the short open tag option
on.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 20:58.]
Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatrici ana/
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 12:29:00 von Alan Silver
In article , Toby A Inkster writes
>Paul Lautman wrote:
>
>> Anyway, your problem is that is what is called a "short open tag" and
>> in the more recent releases of php their use is disabled by default.
>>
>> So instead of =$CFG_db_user?> use
>
>Or (less work for you) find php.ini and switch the short open tag option
>on.
Thanks to both of you for your help. I tried changing php.ini and the
pages worked fine.
If I went through all the .php files in this collection and did a global
find and replace for "" to "
there likely to be anything that might get thrown out by this? Obviously
I would have to check that they hadn't used any
change would result in
problems!
Thanks again
--
Alan Silver
(anything added below this line is nothing to do with me)
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 12:30:13 von Alan Silver
In article <2YednTuHLtKDyhDanZ2dnUVZ_gSdnZ2d@comcast.com>, Jerry Stuckle writes
>Paul gave you the reason. Now you should take this back to whomever
>wrote that junk and make them fix it.
Don't worry, I will! They tried to convince me that PHP wasn't working,
even though I pointed out that my (admittedly simple) test pages had
worked fine. Now I know what the problem is, I can address it directly.
Thanks
--
Alan Silver
(anything added below this line is nothing to do with me)
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 13:22:28 von Toby A Inkster
Alan Silver wrote:
> If I went through all the .php files in this collection and did a global
> find and replace for "" to "
> there likely to be anything that might get thrown out by this?
Search and replace ought to be fine. Just remember that there are three-
types of shorttag:
... ?>
<% ... %>
= ... ?>
The first two should be replaced with:
The last one should be replaced with:
The files you need to be careful with are XML files or PHP files that
generate XML output -- this is because '' is a commonly used construct
in XML to introduce a "processing instructions", such as an XML version
hint, or link to a CSS stylesheet or XSLT transformation.
Indeed, it's because of this '' confusion with XML that shorttag is
disabled by default in more recent versions of PHP. Careful authors can
author XML with PHP with shorttag enabled and not have any problems. But
not everyone is careful. ;-)
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 23:29.]
Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatrici ana/
Re: Please help a newbie - PHP is running, but code is not executed
am 16.01.2008 18:13:39 von Alan Silver
In article <4h9165-9lc.ln1@ophelia.g5n.co.uk>, Toby A Inkster writes
>Search and replace ought to be fine.
Thanks for that. I have had quite a bit of hassle with this code, even
after sorting out the short tags, and it looks like we might just drop
the whole thing. The code doesn't seem very good, and the support from
the company who wrote it is poor. I think we'll do without it ;-)
Thanks for the help.
--
Alan Silver
(anything added below this line is nothing to do with me)