Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:40:42+00:00 2026-05-13T05:40:42+00:00

What do php geeks, professionals, and all others us to log their flat files.

  • 0

What do php geeks, professionals, and all others us to log their flat files.

Are there functions that can just log one .php page?

Can the logging in php be controlled?

On a side-note, anyone used this for logging?
[http://www.monperrus.net/martin/phpmodlog%5D%5B1%5D

Apparently my first question was not clear…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:40:42+00:00Added an answer on May 13, 2026 at 5:40 am

    You could create a function that uses fwrite to write your events to a log file.

    eg:

    function logEvent($message) {
        if ($message != '') {
            // Add a timestamp to the start of the $message
            $message = date("Y/m/d H:i:s").': '.$message;
            $fp = fopen('/path/to/log.txt', 'a');
            fwrite($fp, $message."\n");
            fclose($fp);
        }
    }
    

    You should also add checks that the file is writeable, which you can find code for on the fwrite page.

    For each of the events that you mention, you can then do:

    // Log that user has started playing
    logEvent('User '.$user.' has started playing Battleships.');
    

    Expand it to include/do whatever you want.

    Edit: You’ve edited your question, but I’ll leave my answer here because you may find it useful. As others have mentioned though, you really can’t reliably tell when someone has closed the browser window. Also changed to append rather than override.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP treats all arrays as associative, so there aren't any built in functions. Can
PHP, for all its warts, is pretty good on this count. There's no difference
PHP_CodeCoverage 1.1 removed the singleton accessor for PHP_CodeCoverage_Filter that allowed our PHPUnit bootstrap.php files
Hey all of you PHP geeks, and hackers, if some of you listen ;o)
PHP 5.4 was just released. Is there any way to upgrade my yum installation
PHP, as we all know is very loosely typed. The language does not require
PHP (among others) will execute the deepest function first, working its way out. For
I am writing a PHP application targeted at non-geeks, non-programmers. I need to create
PHP Image resize returns only black background. I read all similar posts here, but
PHP Fatal error: Default value for parameters with a class type hint can only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.