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

  • Home
  • SEARCH
  • 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 8300119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:25:50+00:00 2026-06-08T16:25:50+00:00

I have an error system that take the date() and the error and insert

  • 0

I have an error system that take the date() and the error and insert it into a file:

$fp = fopen('errorFile.txt', 'a');
$message = "At the time: " . date("Y,m,d\|H:i:s") . " the following error took place: " . $e->getMessage();
fwrite($fp, $message);
fclose($fp);

My problem: for start at the fopen at the second parameter I need the pointer to be at the start and that looked at the manual and I need the parameter to be writing only, put the pointer at the start and not truncate the file to zero length, and the only I found is the parameter ‘a’ all is good with ‘a’ except the pointer at the end each time, so if anyone know what parameter can I use, so the pointer at the start and it’s write only and it wont truncate the file to zero length, also I am trying as you see to insert the date and for example: the time here is 18:00 the time was inserted is 15:00.

  • 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-06-08T16:25:52+00:00Added an answer on June 8, 2026 at 4:25 pm

    You can try this logic

    $message = "At the time: " . date("Y,m,d\|H:i:s") . " the following error took place: " . $e->getMessage();
    
    $file = '/path/to/file';
    
    $fileContents = file_get_contents($file);
    
    file_put_contents($file, $message . $fileContents);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a system that logs errors. Selection from my errortable: SELECT message, personid,
I have this error message could not load assembly 'system.data.entity, version 4.2.0.0, culture=neutral,publickeytoken=b77a5c561934e089' or
I have a python script that will take each file in a directory, iterate
I am getting error of System.MissingMethodException after I have an optional parameter in one
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
Have error ValueError: time data '2012-03-15 9:45:00 AM' does not match format '%Y-%m-%d %H:%M:%S'
Hello i have error when i am forwarding page without parameter. that is happen
I experience strange problem. We have error handling in global.asax that would redirect user
I am taking a line from a file only if that file doen't have
DateTime::Diff should calculate a proper interval and take into account Daylight Savings Time (DST)

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.