I would like to log errors / informational and warning messages from my web application to the log. At first I thought about registering all these files in a text file.
However, my PHP web application will need write access to the log files, and the folder where this log file is located may also need write access if you want to copy a log file that is not in my web application. An alternative is that I am logging messages in a MySQL database, as my web application already uses the MySQL database for all of its data warehouse needs.
However, it seemed to me that the transition with the MySQL option is much better than the file parameter, since I already have a configuration file with database access information protected using file system permissions. If I go now with the log file option, I need to change the permissions of the files and folders, and this will make my application less secure and defeat the whole purpose of registration.
Updated: Another advantage that I see with the db option is that there is no need to re-open the db connection for each of my webpage using persistent db connections, which is not possible when registering files. In the case of registering files, I will need to open, write to the log file and close the file for each page.
It is right? I am using XAMPP for development and new to LAMP. Please let me know your registration guidelines. Thanks.
Update: I am more inclined to log using log4php to a text file in a separate folder on my web server and provide write access for my Apache account to this folder.
security php mysql logging xampp
naivnomore
source share