PHPword error Could not create a temporary file

the error message is as follows:

Could not create a temporary file with unique name in the specified directory.

error file:

TemplateProcessor.php line 79
Oct.11,2021

(1) there is no permission to operate the folder (you need to give up 775 permissions to make it work)
(2) check the owner and owner group of this folder, maybe the current user does not have read / write permission to the current folder, or you can repair it by providing additional permissions for the folder (777)
(3) check your tmp folder if it is also writable. There are many variants on the Internet how to do, in my case, I just changed the path to the tmp folder in the vendor / phpoffice / phpword / src / Settings.php, function getTempDir (), I have hard-coded the current absolute path to the working directory and the problem is gone. But maybe it's not the best idea.


find the line of code in which you want to create a file, usually that directory is not configured correctly or does not have writeable permissions.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e336e8-44213.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e336e8-44213.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?