Reply to Re: .php5 versus .php

Your name:

Reply:


Posted by shimmyshack on 02/15/07 22:15

On Feb 15, 6:05 pm, Kimmo Laine <s...@outolempi.net> wrote:
> McKirahan kirjoitti:
>
>
>
> > "McKirahan" <N...@McKirahan.com> wrote in message
> >news:dO6dnRHVOfLPGknYnZ2dnUVZ_uy3nZ2d@comcast.com...
> >> I am working in two environments neither configuration of
> >> which I can change; one's my Web host the other a client.
>
> >> My Web host requires the use of the ".php5" extension
> >> to use PHP v5.1.4; where ".php" is used for PHP v4.3.11.
> >> My client supports PHP v5.2.0 with the ".php" extension.
>
> >> Is there a way to reliably determine if the ".php5" extension
> >> must be used on a server? Perhaps via a "phpinfo()" value?
>
> >> I have a page that uses the v5 function "file_put_contents()".
> >> (I like it's LOCK_EX feature.)
>
> >> Thanks in advance.
>
> > I tried this (to not write to the file in the function isn't supported):
>
> > try {
> > file_put_contents($file, $text, FILE_APPEND+LOCK_EX);
> > } catch (Exception $e) {
> > echo "Caught exception: ", $e->getMessage(), "\n";
> > }
>
> > but got this error:
>
> > Parse error: parse error, unexpected '{' ...
>
> > It doesn't like my use of "try - catch".
> > Why isn't "try - catch" documented?
> > I found only one reference; (under "Exceptions").
>
> Don't know if these help you any but two observations:
>
> 1) you can get the version of php with phpversion();http://fi.php.net/manual/en/function.phpversion.php
>
> 2) You can test wether a function exists with
>
> if(function_exists('file_put_contents')){
> file_put_contents($file, $text, FILE_APPEND+LOCK_EX);} else {
>
> echo "craptastic!";
>
> }
>
> --
> "En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
> s...@outolempi.net | Gedoon-S @ IRCnet | rot13(x...@bhgbyrzcv.arg)

also your code had a typo in it:

try
{
file_put_contents($file, $text, FILE_APPEND+LOCK_EX);
}
catch (Exception $e)
{
echo "Caught exception: ". $e->getMessage(), "\n";
} |
__________________________|
(should have been a dot after caught exception)

as for .php5, just use an .htaccess file to rewrite all extensions of
one sort to the other, whatever suits. 1and1 are like this, but the
htaccess rewrite rules work fine.

[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

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