facebook twitter hatena line email

「Vps/kagoya」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(phpで、smartyテンプレ書き込みで警告が出る場合)
 
(同じ利用者による、間の1版が非表示)
行15: 行15:
  
 
対策
 
対策
<pre>
+
書き込みdirにselinuxの設定をする
dnf reinstall -y \
+
selinux-policy \
+
selinux-policy-targeted \
+
policycoreutils \
+
policycoreutils-python-utils \
+
libselinux \
+
libselinux-utils \
+
libselinux-python3
+
</pre>
+
  
キャッシュ再生成
+
[[Linux/selinuxインストール]] [ショートカット]
fixfiles onboot
+
 
+
書込dirのselinuxの設定(一時的)
+
<pre>
+
chcon -R -t httpd_sys_rw_content_t \
+
/var/www/zend/project1-test/application/modules/default/views/templates_c
+
 
+
chcon -R -t httpd_sys_rw_content_t \
+
/var/www/zend/project1-test/application/modules/admin/views/templates_c
+
</pre>
+
 
+
書込dirのselinuxの設定(永続)
+
<pre>
+
semanage fcontext -a -t httpd_sys_rw_content_t \
+
"/var/www/zend/project1-test/application/modules/default/views/templates_c(/.*)?"
+
semanage fcontext -a -t httpd_sys_rw_content_t \
+
"/var/www/zend/project1-test/application/modules/admin/views/templates_c(/.*)?"
+
</pre>
+
 
+
反映
+
<pre>
+
restorecon -Rv /var/www/zend/project1-test/application/modules/default/views/templates_c
+
restorecon -Rv /var/www/zend/project1-test/application/modules/admin/views/templates_c
+
</pre>
+
 
+
===書込dirのselinuxの削除設定(永続)===
+
<pre>
+
semanage fcontext -d "/var/www/zend/project1-test/application/modules/default/views/templates_c(/.*)?"
+
</pre>
+

2026年4月14日 (火) 00:50時点における最新版

phpで、redisに接続できない場合

php-fpmが、起動しない場合

selinuxが効いてるので解除

$ /usr/sbin/getsebool -a | grep httpd_can_network_connect
httpd_can_network_connect --> on
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
$ sudo /usr/sbin/setsebool -P httpd_can_network_connect on

phpで、smartyテンプレ書き込みで警告が出る場合

エラー詳細

Uncaught SmartyException: unable to write file

対策

書き込みdirにselinuxの設定をする

Linux/selinuxインストール [ショートカット]