Cara menggunakan change php.ini ubuntu

I am currently trying to locate the correct php.ini file to edit it and restart apache so the changes will take place and I'm stumped.

Table of Contents

  • Get PHP information using CLI
  • Where can I find php.ini file?
  • How do I open php.ini file?
  • How do I reload php.ini file after updating?
  • How do I open php.ini file in Linux terminal?
  • What is the location of php.ini file in WordPress?
  • You may also like
  • About the author
  • How do I open a .ini file in Linux terminal?
  • Where is PHP ini on Ubuntu?
  • How do I open a PHP ini file?
  • How do I open PHP ini in text editor?

I have found three different php.ini files (no idea why there are three) this is how I found the files

$ sudo find / -name php.ini /etc/php5/cli/php.ini /etc/php5/apache2/php.ini /etc/php5/cgi/php.ini

I also did....

$ sudo php -i | grep 'Configuration File' Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /etc/php5/cli/php.ini

I changed all of them (just to be sure) to the settings I wanted.

I restarted apache using

sudo service apache2 restart

The results...

* Restarting web server apache2

I reloaded the page and it showed that the php.ini file was not updated.

I know this because I used

echo ini_get('post_max_size');

Which was supposed to be changed to 20M but was still only 2M

I tried rebooting my computer thinking maybe that would stop the apache server and reload the php.ini file with the correct setting, but alas that attempt also failed.

Is there any chance there could be another php.ini file that could be interfering?

  • Find php.ini File Location
  • Get PHP information using CLI
  • FAQs
    • Where can I find php.ini file?
    • How do I open php.ini file?
    • How do I reload php.ini file after updating?
    • How do I open php.ini file in Linux terminal?
    • What is the location of php.ini file in WordPress?

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.

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

  1. Login to your server via ssh.
  2. Now check the installed php version using below command.
$ 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.

# php -i | grep php.ini

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.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

You may also like

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

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

How to Edit PHP ini File in Ubuntu Terminal.

sudo nano /etc/php5/apache2/php.ini. sudo nano /etc/php5/apache2/php.ini. Change PHP parameters. ... .

max_execution_time = 60. max_execution_time = 60. Once you have changed the configuration values, save and exit the editor. ... .

sudo service apache2 restart. sudo service apache2 restart..

Where is PHP ini on Ubuntu?

ini is usually located in /etc/php/8.1/fpm/php.

How do I open a PHP ini file?

For Windows, you can find the file in the C:\xampp\php\php. ini -Folder (Windows) or in the etc -Folder (within the xampp-Folder). Under Linux, most distributions put lampp under /opt/lampp , so the file can be found under /opt/lampp/etc/php.

How do I open PHP ini in text editor?

Via WHM.

Start by logging into WHM as the root user. ... .

Then, click on PHP Configuration Editor..

Once you click on PHP Configuration Editor, you will be presented with a number of different parameters that you may edit the configurations for. ... .

Once you have made your changes, click "Save" at the bottom..

Postingan terbaru

LIHAT SEMUA