Cara menggunakan find php ini

Saya menggunakan xamppserver untuk pengembangan PHP dan ingin mengedit file php.ini; di mana saya dapat menemukannya?

Table of Contents

  • Method 1 (phpinfo file): #
  • Method 2 (PHP.ini & grep command) #
  • Method 3 (locate command) #
  • How To Modify PHP Settings via the MultiPHP INI Editor
  • How to Create a New php.ini File
  • How can I find PHP ini file?
  • Where is the PHP ini file in Windows?
  • Where can I find PHP ini in browser?
  • Can not find PHP ini file?

Untuk Windows, Anda dapat menemukan file di dalam folder C:\xampp\php\php.iniWindows) atau di folder etc- ( di dalam Folder xampp).

Di bawah --- (Linux, sebagian besar distribusi meletakkan lampp di bawah /opt/lampp, sehingga file tersebut dapat ditemukan di bawah /opt/lampp/etc/php.ini.

Itu dapat diedit menggunakan Text-Editor normal.

Klarifikasi:

  • Xampp (X (untuk "beberapa OS"), A pache, M ySQL, P erl, P HP)
  • Lampp (L inux, A pache, M ySQL, P erl, P HP)

dalam konteks ini, mereka dapat saling menggantikan.

Tuliskan yang berikut di dalam phpini_path.php (atau AnyNameAsYouLike.php) dan jalankan di browser.

<?php phpinfo();?>

Di antara berbagai parameter lain, Anda akan mendapatkan Loaded Configuration File parameter yang nilainya adalah jalur php.ini di server.

Lokasi php.ini tergantung pada sistem operasi server:

Windows (Dengan Instalasi Xampp):

/xampp/php/php.ini 

macOS, OS X:

/private/etc/php.ini

Linux:

/etc/php.ini
/usr/bin/php5/bin/php.ini
/etc/php/php.ini
/etc/php5/Apache2/php.ini

Jika Anda menjalankan banyak versi php (xampp dll), saya menemukan yang paling mudah adalah dengan menggunakan:

php --ini

dari baris perintah. Di windows: baik setelah Anda mengklik Shell di xampp, atau langsung di cmd biasa untuk menemukan versi "global" dari php. Dengan global yang saya maksud adalah versi yang dirujuk oleh variabel lingkungan Anda.

Di MacOS: /Applications/XAMPP/xamppfiles/etc/php.ini

Jalankan server Xampp.

  1. Pergi ke http: // localhost yang akan membuka dasbor xampp.

  2. Buka tautan PHPInfo di bilah navigasi atas.

--- atau langsung ketik url berikut di browser setelah menjalankan XAMPP http: //localhost/dashboard/phpinfo.php

Ini akan membuka halaman info php. Di sana Anda dapat menemukan "File Konfigurasi Loaded /opt/lampp/etc/php.ini" yang merupakan lokasi php.ini.

Letakkan skrip di suatu tempat di root dokumen Anda

<?php
phpinfo();

Di antara yang lain, output dari fungsi akan memberi tahu Anda php.inis mana yang diuraikan sebelum skrip dieksekusi.

oS saya adalah ubuntu, XAMPP diinstal di /opt/lampp, dan saya menemukan php.ini di /opt/lampp/etc/php.ini

saya menggunakan xampp dengan PHP 7. Anda dapat mencoba mencari php.ini di

/etc/php/7.0/Apache2

Saya menjalankan LAMP pada Debian dan milik saya ada di:

/etc/php/7.0/Apache2/php.ini

Jika Anda telah menggunakan installer yang berbeda, Anda mungkin berakhir dengan lebih dari satu file php.ini di hdd Anda, yang dapat memengaruhi kewarasan Anda setelah beberapa saat.

Cari hdd Anda untuk 'php.ini' kalau-kalau ada lebih dari satu.

Langkah lain untuk menghemat kewarasanan adalah mengingat untuk selalu me-restart server Anda (Apache) setelah mengubah nilai dalam php.ini.

dalam kasus saya hadir sebagai "php.ini-development" dan "php.ini-production" di folder php

seperti KingCrunch tunjukkan, menggunakan phpinfo Anda dapat melihat file config apa yang sedang beraksi di baris "Loaded Configuration File". dalam kasus saya adalah di C:\xampp\Apache\bin perhatikan bahwa ada php.ini juga di C:\xampp\php yang tampaknya berlebihan dan tidak relevan

Saya selalu menemukan cara termudah adalah php -i dan memfilter ke bawah.

* nix (termasuk MacOS):

php -i | grep "Loaded Configuration File"

Windows:

php -i | findstr /C:"Loaded Configuration File"

Tentu saja ini mengasumsikan lingkungan CLI Anda menggunakan binari PHP yang sama dengan server web Anda yang sebenarnya.

Anda selalu dapat memastikan bahwa menggunakan which php di * nix dan where php di Windows.

Saya mengalami kebutuhan saat menjalankan PhpStorm di Mac saya. Ikuti teks oranye.

Cara menggunakan find php ini

Imagine you are given a server and you are asked to change its PHP settings. Also, assume that several different versions of PHP are installed on this server. What do you think is the best way to find a PHP configuration file? You will find the answer to this question below.

Table of Contents

  • Method 1 (phpinfo file): #
  • Method 2 (PHP.ini & grep command) #
  • Method 3 (locate command) #
  • How To Modify PHP Settings via the MultiPHP INI Editor
  • How to Create a New php.ini File
  • How can I find PHP ini file?
  • Where is the PHP ini file in Windows?
  • Where can I find PHP ini in browser?
  • Can not find PHP ini file?

Method 1 (phpinfo file): #

One way to find out exactly which php.ini file your web sever is using is by creating a new PHP file in document root called info.php

<?php
phpinfo();
?>

Load this file in your browser, press CTRL + F and search for “Loaded Configuration File”. You should see something like.

This will tell you the exact location of the php.ini file you want to edit.

Method 2 (PHP.ini & grep command) #

In Linux, run this command to locate the PHP.ini configuration file.

 $ php -i | grep "Loaded Configuration File" 

Or better way:

 $ php -i | grep ini 

Or in Windows Command Line:

 $ php -i | findstr /c:"Loaded Configuration File"

The result should be something like this.

 $ Loaded Configuration File =&gt; /etc/php/7.4/cli/php.ini

Method 3 (locate command) #

Using the locate command in Linux. If it’s not already installed, run sudo apt install mlocate [On Debian/Ubuntu] and sudo yum install mlocate [On CentOS/RHEL]

 $ locate php.ini

You should see a list of php.ini files here.

How install PHP extension (like Zip) on Cantos / Ubuntu / Linux

  • Overview
  • Available PHP Versions
  • How to Update PHP
  • Fix MultiPHP Error
  • php.ini
  • Limits
  • View Settings

The php.ini file is a special file for PHP. It is where you declare changes to your PHP settings. The server is already configured with standard settings for PHP, which your site will use by default. Unless you need to change one or more settings, there is no need to create or modify a php.ini file. If you would like to make any changes to settings, please do so through the MultiPHP INI Editor.

  • How To Modify PHP Settings
  • How To Create a New php.ini File

How To Modify PHP Settings via the MultiPHP INI Editor

There may be times where you need to change some of the default PHP settings, and below we've outlined those steps. However, keep in mind that there are PHP Settings That Cannot Be Changed on our Shared, Cloud, & Reseller hosting.

To modify the PHP settings:

  1. Log in to cPanel.
  2. In the Software section, click on the MultiPHP INI Editor icon.
  3. On the MultiPHP INI Editor page, select Home Directory or the specific domain you wish to update from the Configure PHP INI basic settings dropdown.
  4. Select the new setting for each PHP directive you would like to change.
  5. Click Apply at the bottom to save your changes.

How to Create a New php.ini File

Important Note: HostGator won't know why you want or need to change these settings. You would change this at the advice of your web designer or the developer of your script. HostGator can only show you where to make the change.

  • For Plesk users, the file should already exist in the directory  /var/www/vhost/$DOMAIN/etc/php.ini.
  • For the cPanel, this file should be created in your Home directory (/home/username/).

The username is your actual cPanel username, and $DOMAIN is your actual domain.

To create a new php.ini file in your cPanel:

  1. In the Files section of your cPanel, click on the File Manager icon.
  2. Select the root directory for your site. The default for the primary is public_html.
  3. Click the + File button at the top left of the page.
  4. In the pop-up box, enter php.ini in the New File Name field. Make sure the root directory is in the bottom box.
  5. Click Create New File.
  6. Locate and right-click the new php.ini file and select Edit, then click the Edit button again.
  7. You can now input the contents of your php.ini file. Click Save to save your changes.

How can I find PHP ini file?

Your answer.

You can get a full phpinfo() using : php -i..

And, in there, there is the php.ini file used : $ php -i | grep 'Configuration File' Configuration File (php.ini) Path => /etc Loaded Configuration File => /etc/php.ini..

On Windows use find instead: php -i|find/i"configuration file" Hope this is helpfull!!.

Where is the PHP ini file in Windows?

If you're running Windows, you'll likely find the php. ini file within the directory of your PHP installation in the system drive.

Where can I find PHP ini in browser?

Use your browser to go to http://example.com/info.php, where example.com represents your web site's domain name. The page displays a large amount of information about the PHP installation. For security reasons, you should disable any calls to the phpinfo() function when web site development and testing is complete.

Can not find PHP ini file?

Your php. ini file should be located either in the 'Configuration File Path' section, or like in my case in 'Loaded Configuration File' section. The first location is the default one, the second location applies in case your PHP installation is used as a module.