PhpSpreadsheet_WriterException

I am getting error : " PhpOffice\PhpSpreadsheet\Writer\Exception ## Could not open C:\Windows\Temp\php26BD.tmp for writing."
while downloading any document in “Yii 2 Advanced”.
and and also I want to know where to put user.ini folder.

The error message you mentioned seems to indicate a problem with file permissions or paths in a Yii2 application. Specifically, it appears that the application is trying to write to a temporary file in C:\Windows\Temp\ but is unable to do so.

Here are some steps you can take to troubleshoot and resolve this issue:

1. Check File Permissions

Ensure that the user account running the PHP process (e.g., IIS, Apache) has write permissions to the C:\Windows\Temp\ directory.

  1. Locate the C:\Windows\Temp\ Directory:
  • Navigate to C:\Windows\Temp\ using File Explorer.
  1. Check and Modify Permissions:
  • Right-click on the Temp folder and select “Properties.”
  • Go to the “Security” tab.
  • Check if the user account running the web server has write permissions. If not, add the appropriate permissions.

2. Check PHP Configuration

Ensure that the PHP configuration is set to use the correct temporary directory.

  1. Open php.ini:
  • Locate and open your php.ini file. The path can vary depending on your PHP installation.
  1. Find the sys_temp_dir Directive:
  • Ensure it is set to a valid directory that the PHP process can write to.

ini

Copiar código

sys_temp_dir = "C:\Windows\Temp\"
  1. Restart Web Server:
  • After making changes to php.ini, restart your web server (e.g., IIS, Apache) to apply the changes.

3. Verify Disk Space

Ensure there is enough disk space available on the drive where the temporary directory resides.

  1. Check Disk Space:
  • Open “This PC” in File Explorer and check the available space on the C: drive.