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.
- Locate the
C:\Windows\Temp\Directory:
- Navigate to
C:\Windows\Temp\using File Explorer.
- Check and Modify Permissions:
- Right-click on the
Tempfolder 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.
- Open
php.ini:
- Locate and open your
php.inifile. The path can vary depending on your PHP installation.
- Find the
sys_temp_dirDirective:
- 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\"
- 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.
- Check Disk Space:
- Open “This PC” in File Explorer and check the available space on the C: drive.
