Blog Nodeloc

记录一些NodeLoc发展中遇到的问题及解决方法

使用OpenLiteSpeed后修改php.ini不生效


最近更新到OpenLiteSpeed后,发现修改php.ini后,重启OpenLiteSpeed并不能reload php。于是搜了下文档,发现OLS重启PHP的方式真的很怪异。

Restart DetachedPHP Processes

In the past, if there were any php.ini changes, you would probably want to restart OLS to apply the changes, since OLS would also restart PHP processes. Under Detached Mode, this is no longer an option.

If you want to make php.ini changes effective immediately, there are a few ways to restart PHP processes.

For a User

To restart detached PHP processes for the account (vhost) level, you can touch a .lsphp_restart.txt file under the user’s home directory, for example /home/USER1/.

touch /home/USER1/.lsphp_restart.txt

Once .lsphp_restart.txt is created, the user’s PHP will be restarted when the next request comes in. The file .lsphp_restart.txt won’t be removed. OLS will check the timestamp of the file to decide if the user’s detached PHP needs to be restarted or not. You can manually remove it if you want to, but it’s not necessary. Every time you want to restart that user’s detached PHP, you can just touch the file again, whether it already exists or not, in order to refresh the timestamp.

For the Server

To restart detached PHP processes for the server level, you can touch a .lsphp_restart.txt file under the <lsws_server_root>/admin/tmp/ directory. Usually, that is /usr/local/lsws/admin/tmp/.

touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt

All running detached PHP processes will be restarted, but not immediately. Instead, they will restart as soon as the server needs to use that PHP handler.

Stop All Immediately

To stop all lsphp processes immediately, you can manually kill them from the command line:

killall -9 lsphp


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注