My PHP has just been configured. After configuring it, I downloaded and installed Discuz!, but I didn’t expect that I couldn’t upload pictures. Then I also tried other Php programs, but I couldn’t upload pictures either. I’m sure it’s not a problem with the program. There must be something wrong with my PHP configuration. My PHP is configured in IIS environment.
Later, Baidu searched and found the problem. Let’s talk about how to solve the problem of not being able to upload pictures.
1. Open the php.ini file, find the upload_tmp_dir line, remove the previous comment, and modify it to the following line:
upload_tmp_dir = D:temp
2. The above means to set up a temporary directory for uploading. This directory requires writable permissions. Please confirm that D:temp exists, otherwise you will not be able to upload images. Under normal circumstances, we create the temp temporary directory in the root directory of PHP so that it will not be deleted accidentally. Please pay attention to adding a user starting with IUER, that is, adding writable permissions to the IIS user.
3. Restart iis
4. Now you can log in to the discuz backend, click "Tools -> Update Cache", upload pictures, and it's normal!
Usually this is a newly configured server and you forget to configure permissions. This problem is prone to occur. Please remind me again.