我在PHO版本(本机7.2(中遇到Missing a temporary folder
错误。
我已经尝试过以下方法:
define(‘WP_TEMP_DIR’,dirname(_FILE_). ‘/wp-content/temp/’);
但没有结果。你能给我一些解决方案吗?
在配置中添加此代码
define('WP_TEMP_DIR', dirname(_FILE_) . '/wp-content/temp/');
然后在wp-content-folder:(上手动创建临时文件夹。
我刚刚遇到了同样的问题,如果你在谷歌上搜索,有一些明显的解决方案…
在我的情况下,这不起作用。我的设置是:
PHP 7.4.28
Ubuntu 20.4
Apache 2.4.41
WordPress 5.9.2
我遇到了这个问题,最终可以解决这个错误。
简而言之:
apache2/httpd-systemd服务使用PrivateTmp=true
,它自己的tmp-dir版本。这就是为什么wordpress找不到它的"临时文件夹";不再
我通过注释apache2.service
中的各个条目来解决此问题:(如果你非常关心安全,你可能会找到另一种方法来处理它…(
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/
[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl stop
ExecReload=/usr/sbin/apachectl graceful
# PrivateTmp=true
Restart=on-abort
[Install]
WantedBy=multi-user.target
别忘了:
- 重新加载deamon:
sudo systemctl daemon-reload
- 重新启动apache:
sudo systemctl restart apache2
。。。