coolcommands.com - the search engine for unix sysadmins :: unix commands and scripts
Tuesday January 6, 2009


 Home
 Search
 Advanced Search
 Category Search
 Affiliates
 Acknowledgements
 Cool Links

Username

Password

Remember me
Forgot your password?
Create an account

Who's Online
We have 23 guests online

Newest Member

walkaround64

Hit Counter
2833303 Visitors

cool Statistics
coolcommands:1271
Categories:82
Total queries:444921
Members:3196





Search coolcommands.com
Search Keyword:


coolcommand

log.php - php include file to do logging to a text file
Description

This is a PHP include file which does logging of messages to a central logfile. You can use it in all your applications to avoid writing the same code over and over.

Some things to change are:

1) Path and name of logfile
2) Create the logfile before using this function
3) Ensure the file is writable by the user your web server runs as (usually nobody)

To include this file in your PHP pages when you want to do logging, simpy add this line at the top of your PHP page:

require('log.php');

To call the logging function, use this line in your PHP page:

log_action("Your logging message here.\n");

Include code for log.php:

<?php

function log_action($msg) {
if ($fp = @fopen("/var/lib/mysql/php_app.log", "a")) {
fwrite($fp, $msg, strlen($msg));
fclose($fp);
}
}
?>

NOTE: You can also use variables from your PHP page in the logfile message text.
Example

log.php

Return to search results

Random coolcommands

coolcommand: newfs - how to create a filesystem on a metadevice in Solaris Volume Manager
Example: newfs -i 8192 /dev/md/rdsk/d0
[show me the details]
coolcommand: lspv - to get information about physical volumes in IBM AIX
Example: lspv
[show me the details]
coolcommand: mqver - how to determine Websphere MQ version, service level, buildtype and build date
Example: mqver
[show me the details]
coolcommand: mqrc - convert a Websphere MQ exit code to the string name of the error
Example: mqrc 0
[show me the details]

coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts

The UNIX® Ring
[ Join Now | Ring Hub | Random | << Prev | Next >> ]
Unix System Administration Ring
[ Join Now | Ring Hub | Random | << Prev | Next >> ]
Solaris Operating System Ring
[ Join Now | Ring Hub | Random | << Prev | Next >> ]
Itzalist - OPERATING SYSTEMS Ring
[ Join Now | Ring Hub | Random | << Prev | Next >> ]



FREE
myPMS

Password
Management
System

by

LVOware.com




Top 5 Submitters

lvo1102
audet37
kah00na28
Mariom24
lebjf00013

Top 5 Searches

Category Solaris35017
Category AIX28760
Category General UNIX27308
solaris17499
aix16314

Terms of Use
Privacy
Contact


 
coolcommands.com © 2009. All Right Reserved.
Programming by PRATTICO Consulting . Hosting by Apricusum . Graphics by Pixel2Life Studios