|
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)
oh and of course, dont forget the other typo ,->. further on the same
line!!
Navigation:
[Reply to this message]
|