Error_log file writes every page loads

Hello,

I’m sorry, I speak a little English.

  1. Installed LAMP
  2. Installed Yii2 (with Basic) [without Composer]
  3. Changed Yii cookie variable

My error_log file (I think every page load):

[Mon Feb 28 01:33:56.538416 2022] [php7:warn] [pid 489969] [client XX.XX.XXX.XX:33780] PHP Warning:  mkdir(): Permission denied in /var/www/example.com/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 648
[Mon Feb 28 01:33:56.539107 2022] [php7:warn] [pid 489969] [client XX.XX.XXX.XX:33780] PHP Warning:  mkdir(): Permission denied in /var/www/example.com/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 648
[Mon Feb 28 01:33:56.631758 2022] [php7:warn] [pid 489969] [client XX.XX.XXX.XX:33780] PHP Warning:  file_put_contents(/var/www/example.com/runtime/debug/621c97041fa36.data): failed to open stream: No such file or directory in /var/www/example.com/vendor/yiisoft/yii2-debug/src/LogTarget.php on line 74

Why?

Thanks.

Any reason not to use composer?
You have to fix permissions to make sure the server can read the files

Dear Stefano,

Thanks your reply. I just don’t want to use composer.

BaseFileHelper.php line 648:

if (!mkdir($path, $mode)) {

LogTarget.php line 74:

file_put_contents($dataFile, Closure\serialize($data));

My runtime directory permission: 755
In runtime directory only 1 file: .gitignore (no debug directory in runtime directory)

My helpers directory permission: 755
My BaseFileHelper.php file permission: 644

My src directory permission: 755
My LogTarget.php file permission: 644

First thing to try is permission 777 for runtime (and web/assets).

3 Likes

Dear tri,

Solved, thanks. Created directories in runtime directory: debug and logs. No create the error_log file.