Reply to Re: Php random text code to work in version 5

Your name:

Reply:


Posted by pangea33 on 11/15/06 09:01

Create a php page on your PHP5 server, and run this function:
phpinfo();

It will give you lots of details about the server configuration. Under
the section marked PHP Core will be a variable named: "short_open_tag"
If it's set to off, then you have to start your code with the long tag
"<?php" instead of "<?".

This seems likely to be the problem.

http://us2.php.net/ini.core

On Nov 14, 1:57 pm, "chris.huh" <chris....@gmail.com> wrote:
> Oh, cheers. i will have to find out what must be wrong with my local
> php. I just installed WAMP5, which seems pretty good so maybe something
> is set differently.
>
> Thanks
>
> J.O. Aho wrote:
> > chris.huh wrote:
> > > I have a bit of code i got from a site a while ago. I notice now that
> > > the script does not work on my local machine running php5 but does work
> > > on my hosting server with php4 on it so i am guessing it is somethign
> > > to do with that.
>
> > > The code is:
>
> > > <?
> > > $textfile ="random.txt";
> > > $items = file("$textfile");
> > > $item = rand(0, sizeof($items)-1);
> > > echo $items[$item];
> > > ?>
>
> > > Does anything think that it is because of the versions and if it is how
> > > to fix it?
>
> > PHP 5.1.6 (cli) (built: Oct 12 2006 17:00:51)
> > Copyright (c) 1997-2006 The PHP Group
> > Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>
> > No trouble at all with the unmodified small script, just your local php that
> > must be broken somehow.
>
> > //Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация