Linux php ini reload

How to Restart PHP in Linux / Unix

If you are a relatively new Linux user and you manage a server with PHP, it is important that you know that after editing the php.ini file , you must restart the PHP service.

PHp is associated with your web server or with your external FastCGI process manager. In most cases, after editing the php.ini file , you only need to restart your server, which is probably Apache, Nginx or Lighttpd, depending on what you have installed on your operating system. In this way you can apply the new saved configuration .

We will see how to restart PHP, for which, you must restart your web server. Depending on your web server, you must execute one of the following commands:

Restart Apache to restart PHP

If you use Apache, type the following command:

Or also, with the service command:

Читайте также:  Кнопки социальных сетей javascript

If you use CentOS, the server will have the name of httpd instead of Apache2:

Restart Nginx to restart PHP

If you use the Nginx web server, type the following command to restart it:

You can also use the service command:

Restart Lighttpd to restart PHP

If you use the Lighttpd web server, type the following command to restart it:

Restart PHP-FAM FastCGI to restart PHP

If you use PHP from the PHP-FAM fastcgi manager , use one of the following commands. Depending on your version of Linux, it may be one or the other:

For PHP5 you can also run:

And finally you can also try:

Donations/Tips for Technibuzz.com
Do you find my tutorials useful? Please consider supporting my website. It is hard to keep the site running when so many people block ads. Donating money to Technibuzz is easy!

The tutorials here on Technibuzz.com are provided free of charge. If you wish to make a small contribution, you can choose one of the following options:

  1. BTC (Bitcoin) Address: 1BfQdqBs4sVBUijX4m8jTri51ET2w1FmrH
  2. ETH (Ethereum) Address: 0x498e0bf35d20b1ed80dbe9cd7437808adc5e603f
  3. XMR (Monero) Address:
    87MX19uzcEjgbzsBqU1dEpBnHd86TthwuMEQMZ17E3wN71VZf4qDYPi7GVTEMMeJtyira9cUZvUkLDMwTeNaxEsLLrPj8Jg
  4. Paypal: cybersecurity@technibuzz.com

Share this:

Источник

How to Find php.ini File Location from Command Line

This article will help you to find php.ini file location. php.in file is very useful file to coustomize the PHP behaviour at runtime and it is also a configuration file. Using this you can easily administrator Apache web server. You can set the parameters like uploading director, register global variable, disable errors and many more. If you want to make a quick adjustment to php.in file but you are not sure where it is?

In this article we will learn how to find and edit the php.ini file using command line. If you want to edit php.ini file in Cpanel follow this tutorial edit php.ini file in Cpanel.

Find php.ini File Location

First of all find the php.ini file location using command line in linux.

$ php --version PHP 7.4.6 (cli) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies

Let’s find the php.ini file using below command.

You will some output like below:

Configuration File (php.ini) Path => /etc Loaded Configuration File => /etc/php.ini

Now you found your php.ini file located in /etc/ directory.

Get PHP information using CLI

To get the php information you can also use CLI . Type “-i” follow by php command. For example:

# php -I # php -i | more # php -i | grep pdo

You can also heck the php loaded module with above but you can also I check the php module using creating php.info file.

FAQs

Where can I find php.ini file?

php.in file is very useful file to coustomize the PHP behaviour at runtime and it is default configuration file for php application. You can set the parameters like uploading director, register global variable, disable errors and many more. So run the ” php -i | grep php.ini” to find the php.ini file location.

How do I open php.ini file?

To open php.ini file you can use any txt editor like, vim, vi, nano etc. example: vim /etc/php.ini.

How do I reload php.ini file after updating?

Reload the apache service simply running, systemctl httpd reload.

How do I open php.ini file in Linux terminal?

To open php.ini file in Linux terminal and just use vim or vi command. For example : vim /etc/php.ini.

What is the location of php.ini file in WordPress?

Default location of php.ini file in WordPress is wp-admin directory.

Источник

Php.ini reload in php-cli

Background: The reason for taking a path is that in fact PHP is looking for different files in order: First a SAPI specific file and then the generic . How I can reload php.ini for console without restart server? Solution: The configuration is loaded fresh each time you invoke PHP from the CLI.

Php.ini reload in php-cli

I have php script that must be runned from console (php-cli). But configuration of php.ini for php-cli was incorrect. I fix it, but when I run script a had error with php config, because php.ini uses an old.

How I can reload php.ini for console without restart server?

The configuration is loaded fresh each time you invoke PHP from the CLI.

Nginx — How do you restart php-fpm?, Then create the file /etc/php-fpm.pid, and make sure php-fpm has permission to modify it: $ cd /etc $ sudo touch php-fpm.pid $ sudo chown _php php-fpm.pid $ sudo chmod 644 php-fpm.pid. Now, next time php-fpm starts, you’ll be able to get its pid and restart it like this: $ cat /etc/php-fpm.pid 815 $ sudo kill …

PHP not loading php.ini

Running PHP/Apache on a redhat 6.5 environment. Running into some issues with the PHP installation. PHP was installed and compiles from source and I used the following command to configure it.

'./configure' '--prefix=/u/g/php' '--with-libxml-dir=/u/g/util/libxml2/' '--with-apxs2=/u/g/apache/bin/apxs' '--with-config-file-path=/u/g/php/config' '--enable-mbstring' 

This works I can run php and appache. However I am trying to enable some extension and the php.ini file I have configured is not getting read.

Configuration File (php.ini) Path /u/g/php/config 

However as I understand it, it should contain the file like so /u/g/php/config/php.ini

Started/stopped the service..

Most servers have more than one php.ini file. My best guess is that you’re editing the wrong one. To see which one is actually being used by php, run this:

Edit: if this returned ‘not loaded’, try this in SSH:

Also, be sure to restart apache after changing the php.ini file.

Sometimes due to error in php.ini files the configuration files are not loaded after that specific error line. In that case you have to thoroughly check the php.ini file and fix the errors.

Alternatively you can download fresh php.ini files for your php version and replace your existing file with the new one.

After making changes in the new file restart your server using service apache2 restart

How to restart PHP on Windows? Unable to find the, To restart PHP on IIS, you actually need to restart IIS: Go to Start -> click Run -> type iisreset, and then click OK. If iisreset command is not recognized, then Click win -> search » Turn windows features on or off » Tick the checkbox » Internet Information Service » click ok and after completion try the above …

Do I need to restart Apache after changing the php.ini file?

If I make a change to a setting in the php.ini file — do I need to Restart Apache in order for it to take effect?

Depends, actually. Depends on how you use php inside that webserver:

  • using php as module inside the http server: you have to restart the http server process
  • using php as cgi backend: you do not have to restart the http server process or anything else
  • using php fastcgi: you have to restart the fastcgi daemon, not the http server
  • using php-fpm: you have to restart the fpm server process, not the http server process

On Debian 8 I had to restart php-FPM (and Apache) The above answers are correct, but here are the commands so you won’t have to googling them.

sudo service php5-fpm restart 

That depends on the SAPI you’re using. If you’re using PHP as an Apache module for example, you need to restart apache so that the php.ini values take effect.

If you’re using FCGI, you need to restart the FCGI daemon for the PHP script that you want to see the values changed. Compare with

It depends on what OS and version you are running.

I am running Apache/2.4.29 under Ubuntu.

I restart apache with the following command and the restart is needed after modifying the php.ini file:

sudo service apache2 restart 

How to locate the php.ini file (xampp), 4k 2 63 89. Add a comment. 1. step1 :open xampp control panel. step 2: then click apache module config button. step 3. after that you able to see some config file list. step 4: then click the php.ini file.it will be open into default editor. image was given blow for refernce. Share.

PHP 4 won’t take PHP.ini changes after Apache restart

We have a very old PHP application that needs PHP 4 to run. We’re decommissioning the old server and so I’ve built PHP 4 on the new server (Ubuntu 13.04 32 bit). When I did ./configure I made sure to do —with-config-file-path=/etc/php4/php.ini . I’m trying to enable error logging, but my changes to the php.ini don’t seem to be taking hold.

Yes, the file exists and is owned by the Apache user

nick@server:/etc/php4$ ls php.ini 

Yes, I restarted Apache. And yes, it shows up in the phpinfo() :

Configuration File (php.ini) Path /etc/php4/php.ini 

Does the —with-config-file-path only take hold at compilation time and thus in order to make changes I have to recompile? Or does it work the same as newer versions of PHP?

For example, in the php.ini I’ve turned off display_errors , but phpinfo() shows:

Note that it shows On for both the local and master values for this server.

Also, I’m sorry for perpetuating PHP 4

My php.ini and screenshot of phpinfo to prove I’m not lying

—with-config-file-path expects a directory, not a filename. So with your confiuration PHP would look for /etc/php4/php.ini/php.ini .

Background: The reason for taking a path is that in fact PHP is looking for different files in order: First a SAPI specific file php-$SAPI.ini and then the generic php.ini . This allows i.e. using a different configuration on CLI where initial startup time matters more and other caching settings (apc etc.) are required.

Php.ini not being read with windows 7 installation, A handy way to check this is to run where php.ini from the command prompt. Add your PHP install and extensions folders to the system PATH: For example — c:\php and c:\php\ext. Edit your php.ini file and ensure that the extension_dir directive points to the extensions folder: extension_dir=c:\php\ext. …

Источник

Оцените статью