PHP - write in a file PHP - write in a file unix unix

PHP - write in a file


Make sure /var/www/dreamteam/logs/ and the log file (if it exists) are writable by Apache. If you have SSH access, log in and use chmod and/or chown on the command line. Otherwise you may have to do it with a graphical FTP client.

For quick-and-easy testing, make them world-writable, e.g. permissions of 0777. But for security, you'll want to figure out what username Apache is running as, and make your log directory's and file's ownership equal to that, and also reduce the permission level. You want to use the minimum permissions necessary to do the job. I often use 0700 for directories and 0500 for files.