Home > Backend Development > PHP Problem > How to modify php.ini in linux

How to modify php.ini in linux

藏色散人
Release: 2023-03-07 16:56:01
Original
3768 people have browsed it

How to modify php.ini in Linux: First find "php.ini" through the command "php -i | grep 'php.ini'"; then modify the file content; and finally restart PHP.

How to modify php.ini in linux

The operating environment of this tutorial: linux5.9.8 system, PHP7.1 version. This article is applicable to all brands of computers.

Recommended: "PHP Video Tutorial"

Modify the php.ini file under Linux

Find the .ini path

#如果安装了PHP环境,可以使用php命令
##第一种方式
[root@tt ~/php7]$ php -i | grep 'php.ini'
Configuration File (php.ini) Path => /home/root/php7/lib
Loaded Configuration File => /home/root/php7/lib/php.ini
##第二种方式
php --ini
#如果没有安装PHP环境,使用linux自带的命令
find / -name php.ini
Copy after login

Restart PHP in Centos

After modifying etc/php.ini, you must restart PHP to take effect

Method 1

# 查到master process (/etc/php-fpm.conf)的进程号
ps aux | grep php-fpm
root     4811  0.0  0.0 173300   884 pts/1    S+   18:39   0:00 grep php-fpm
 
# 杀掉进程
kill -QUIT xxxx
 
# 重启
/etc/init.d/php-fpm
Copy after login

If you install PHP, set Obtain permissions and start php-fpm:

chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
chkconfig –add php-fpm
Copy after login

Method 2

You can also start, stop and restart as a service:

service php-fpm start
service php-fpm stop
service php-fpm reload
Copy after login

Some experience

#报错日志修改长度
log_errors_max_len = 20480
Copy after login

The above is the detailed content of How to modify php.ini in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template