what happen if i delete apache log file? - apache

I have 4 files in /var/log/apache2 and I just deleted 2 of them (I do have backups). would it affect apache's logging capabilities? does apache automatically create files and write to them if they don't exist?

It will create new file automatically.

The file is deleted but the file handle remains until you reload/restart apache, at least on Rhel 7.
You can verify this by running sudo lsof | grep access_log after deleting /var/log/httpd/access_log.
You might see the file automatically getting recreated some time later when logrotate runs, as that issues a reload which would then trigger the file to be created again.

Related

Laravel failed to listen on 127.0.0.1:8000 (reason ?)

So I just created a new project using the command:
laravel new blog
Then I started by changing the directory and do the command
php artisan serve
And this is what happened, more details:
I'm using laravel 8.0.1 (latest version)
I haven't run any command except the one I listed above
I'm using windows
I even updated the php to 7.4.10 (latest ver)
I came across the same issue.
This was how how I solved mine:
Goto the main PHP part, I mean the installed PHP from official website.
Look out for a folder named php.ini-development
Duplicate this file.
Then rename the copy to php.ini
Go back to your laravel project folder and rerun php artisan serve
PS: If there is any additional steps you took, you can as well comment them below:
XOXO
So actually i dont actually know what the reason is, but using the php -S localhost:8000 -t public
Check your PHP version in your local server and System variable path. Make sure they are using the same PHP version
I had this problem too, and I solved it in this way:
set: php.ini
variables_order = "GPCS"
This error is because the php.ini was not found.
run php --ini
Configuration File (php.ini) Path:
Loaded Configuration File: C:\php8\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
The line "Loaded Configuration File" would indicate the location of loaded php.ini, if not, rename the php.ini-development to php.ini

AMPPS - The file /Applications/AMPPS/ampps/softaculous/includes/enduser.php is corrupted

I've had this issue twice now, just randomly happened.
When I try to view the Ammps 'Home' Dashboard I get the following error:-
The file /Applications/AMPPS/ampps/softaculous/includes/enduser.php is
corrupted.
I had to re-install to fix this last time but since then (a few days ago) this has happened again?
Anybody know why this is happening and how to fix it?
I am using Version: 3.8
Update
I've done another clean install (backed up www and all the databases beforehand). I noticed there isn't even the directory /Applications/AMPPS/ampps/softaculous/includes/.
Seems to be another effected file as well:
/Applications/AMPPS/ampps/softaculous/includes/main/functions.php is
corrupted.
Upon opening these files, it appears a massively long string of characters as been added after the closing PHP tag. Deleting this string had no effect, the same errors persist.
Anyway, I've uploaded the files of Ampps for Mac which you can download here:
https://drive.google.com/file/d/18nA-ldR5BamLLqnEU0nC4Gx-PmzWSwt0/view?usp=sharing
Going to see if I can get it back working once I merge the files together (except the www folder)
Update 2:
You can now download Ampps 3.9 from their official website:
https://ampps.com/download
1.+ don't forget to save database (/var) and domains information (/ampps/data/domains) before replacing files
Doing a clean install of Ampps 3.8 will rectify the problem which is what I had to do. Frustratingly, some people including myself have experienced the issue coming back after a few days. Until there is a permanent fix for this either by an update/patch from Softaculous, a way to rectify this without having to reinstall Ampps is by doing the following:-
Take a backup of your /Applications/AMPPS/www directory
Download the Mac files from a clean installation here;
https://drive.google.com/file/d/18nA-ldR5BamLLqnEU0nC4Gx-PmzWSwt0/view?usp=sharing
Replace the existing Ampps directory with the files from the
download link
Move your /www/ folder back to the same location
You should then be able to access the Home dashboard and everything should work as normal.
As Nika mentioned, don't forget to save database (/var) and domains information (/ampps/data/domains) before replacing files (/www)
Edit 1:
Seems my version of Ampps 3.8 got updated to 3.9, I've not had any issues since this has happened.
Please create a backup first!
Shutdown AMPPS. I have fixed mine locally by replacing the enduser.php with the one from here https://files.ampps.com/5.3.2.zip.
Then after that I have replaced all the IonCube loaders with the ones you can download from here: https://www.ioncube.com/loaders.php. Source and how-to: https://www.softaculous.com/board/index.php?tid=13497&title=Ioncube_Loader_Error
Start AMPPS.
To check if you need to replace another corrupt file check error_log in your logs folder.

Vagrant for web server with shared folders: Apache breaks file permissions if it tries to stat a file before it exists

I'm not sure if this is an issue with vagrant, virtualbox or a configuration issue inside the box itsef, however:
Using the following setup: Apache is running in the guest with its server root set to /srv/http, this is a synched folder which points to ./public_html on the host.
While most of the time it works as expected, the following steps causes an issue
1) Navigate to a file that doesn't exist localhost:8080/test2.css -- shows a 404 error as expected but correctly connects to the guest which is serving the error
2) Create test2.css with some content and place it in public_html
3) Reload localhost:8080/test2.css -- Still shows a 404 error even though the file now exists
4) To debug, run vagrant ssh and then ls /srv/http. Which shows:
ls: cannot access test2.css: No such file or directory
So it's seeing the file, sort of but it shows without any permissions:
-????????? ? ? ? ? test2.css
-rw-rw-r-- 1 vagrant 7 Oct 23 11:13 test3.css
If I then re-save the file as test3.css, a file that hasn't yet been accessed it works perfectly. E.g. on the host, save the file I had open as test3.css and then navigate to it, it works as expected!
Any ideas? On why this might be?
In short: If apache has tried to read a file that doesn't exist, creating that file will then cause it to have invalid permissions. If apache has never tried to read the file before, it can be created and work as expected.
Thanks for any help, I'm really confused by this!
This turned out to be a kernel bug on the guest. Upgrading to 4.2.4 using the same Vagrant/Virtualbox/Guest Modules solved the issue.

#1 - Can't create/write to file '/var/folders/

I get the following error(see. figure) in my Xampp and can not access mySQL through XAMPP and phpMyAdmin. In this link-1 and link-2 possible solution is given; but none of them woks in Mac OS 10.9
I assume the problem is with configuration file my.cnf which is located in the /Applications/XAMPP/xamppfiles/etc/my.cnf.
Any suggestion will be appreciate. Thanks.
Completely stop XAMPP, this means stop apache, ftp and mysql.
Open the program called Terminal.
Type in sudo -i to become root (or do su root if the first doesn’t work for you).
You are most probably asked for a password which you have to enter while no characters are displayed.
Execute chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf .
Exit your root shell with exit or just close Terminal.
Restart XAMPP (apache, ftp and mysql).
From: http://slopjong.de/2009/08/31/houston-i-cant-write-to-file/
Solution
Reinstall Xampp. Before reinstalling delete all the files, take away your htdoc and database folder to other place of your hdd.
The database location in Mac OS-10.9 is
cd '/Applications/XAMPP/xamppfiles/var/mysql/'
Htdoc location
cd '/Applications/XAMPP/xamppfiles/htdocs/'
When you complete reinstallation put all the folders to corresponding location and your database will be automatically update.
I looked some other solution but none of them seems work. I was scare if I remove the database to other location and import later will it work or not. And luckily it works, but as precaution careful when you remove big database.

Delete old tmp file when Apache starts

I'm using Bitnami MAMP Stack on OSX and would like to clear the tmp directory whenever I start the Apache Web Server.
So basically I need to know where to add the following command, or a script containing the command rm -rf ~/Library/Containers/com.bitnami.mampstack/Data/app/php/tmp.
Takk,
Robert.
Just look inside your MAMP program folder. There is ./bin/start.sh
Just add you line to this.
Or to startApache.sh if you want to execute only with Apache restarts.