No php ini found

Where is php.ini? Find the Correct PHP Configuration File

The php.ini file is a configuration file used by PHP to specify settings for your web server, such as file upload size, error reporting, and memory usage. However, the location of the php.ini file can vary depending on your server setup and operating system.

In this tutorial, we will explore a few methods to help you locate the correct php.ini file on your web server.

Method 1: Use phpinfo() function

The phpinfo() function displays detailed information about your PHP configuration, including the location of your php.ini file. To use this function, follow these steps:

  1. Create a new PHP file on your web server. You can name it anything you like, but for this tutorial, we will name it phpinfo.php.
  2. Open the phpinfo.php file in a text editor and add the following code:

You should see a page with detailed information about your PHP configuration. Look for the “Loaded Configuration File” section, which should contain the full path to your php.ini file.

Locate php.ini with phpinfo()

Method 2: Use the command line

If you have access to the command line, you can use the `php —ini` command to find the location of the php.ini file. Follow these steps:

  1. Log in to your web server using SSH or another terminal application.
  2. Type the following command and press Enter:

Locate php.ini for CLI

  • This command will display a list of all the php.ini files that are currently being used, as well as their locations.
  • Method 3: Check default locations

    Depending on your operating system and server configuration, the php.ini file may be located in one of the default locations. Here are some common default locations:

    On Linux:

    On Windows:

    You can try searching for the php.ini file in these locations using your FTP or file manager.

    If none of these methods work, you can contact your web hosting provider or system administrator for assistance in locating the php.ini file on your server.

    Conclusion

    The php.ini file is an essential configuration file for PHP. By following the methods outlined in this tutorial, you should be able to locate the correct php.ini file on your web server. Remember, the location of the php.ini file can vary depending on your server setup and operating system, so it’s important to double-check the location before making any changes to the file.

    Источник

    Where can php.ini be Found

    This tutorial is dedicated to an issue that almost every developer may come across. It’s where to find the php.ini file.

    As multiple versions of PHP exist with different server configurations, the php.ini file may be placed in different folders.

    Here, we will provide you with three methods that will help you to find php.ini in a straightforward way.

    Method 1: Creating a new PHP File

    The first method to find the php.ini file is creating a new PHP file called info.php . Here is how you can implement it:

    You need to load this file in the browser, pressing CTRL + F and looking for “Loaded Configuration File”. You may see what is demonstrated below:

    It will tell you the exact location of the php.ini file.

    Method 2: Using php -i

    For locating the php.ini configuration file, you can run the code below in Linux:

    $ php -i | grep "Loaded Configuration File"

    In the Windows Command Line, you can invoke:

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

    The output will look like this:

    Loaded Configuration File => /etc/php/7.2/cli/php.in

    So, from the example mentioned above, we found out that the PHP install is placed inside /etc/php/7.2 . But, there is an essential thing to consider: there exist three distinct configuration files. Let’s take a look at them:

    CLI

    For the CLI PHP program, there exists /etc/php/7.2/cli/php.ini . Modifications in this config file will only impact PHP because it operates within the terminal. Hence, the web server will not be affected by that.

    APACHE

    For the plugin used for APACHE, there exists /etc/php/7.2/apache2/php.ini . You are required to edit it once you work with the APACHE web server.

    Nginx either Apache with PHP-FPM

    Now, let’s have a look at /etc/php/7.2/apache2/php.ini . It is considered a fastcgi-compatible ‘wrapper’. You are required to edit it once you work with Apache with PHP-FPM or Nginx web server.

    Method 3: Using the locate Command

    The third method is using the locate command in Linux. If you haven’t installed it yet, you can act like this:

    sudo apt update && sudo apt install mlocate

    Then, run the locate command as follows:

    After running this command, you will notice the list of php.ini files.

    How to Edit php.ini in Linux

    In this section, we will demonstrate how to edit php.ini on APACHE and Nginx or Apache with PHP-FPM.

    APACHE

    As a rule, the php.ini file is located in /etc/php/7.2/apache2/php.ini on APACHE. You can replace it with the version that you use. For example, php 7.1 , and so on.

    For editing, you can act like this:

    sudo nano /etc/php/7.2/apache2/php.ini

    If you work with PHP FPM, it can be placed in /etc/php/7.2/fpm/php.ini . So, change the 7.2 version to your own version.

    For editing, you can act like this:

    sudo nano /etc/php/7.2/fpm/php.ini

    Afterwards, you need to press CTRL + X , pressing Y and then — ENTER. In this way, you will save the file and exit it.

    After alerting php.ini, you need to restart APACHE.

    If you use PHP-FMP, you should restart it.

    Nginx or Apache with PHP-FPM

    As a rule, Nginx works with PHP-FPM. The php.ini file is placed inside /etc/php/7.2/fpm/php.ini . You need to replace the 7.2 version with your own one.

    sudo nano /etc/php/7.2/fpm/php.ini

    For saving the file, you need to press CTRL + X . Afterwards, press Y and then ENTER .

    After the alert of the php.ini file, it is necessary to restart Nginx like this:

    After the alert of the php.ini file, it is necessary to restart Nginx like this:

    sudo service nginx restart

    So, in this tutorial, we represented to you three different and efficient ways to find the php.ini file. After checking out all the examples above, you can choose the best one for you.

    Источник

    unixforum.org

    нет php.ini (пхп установлен и работает а php.ini нету)

    нет php.ini

    Сообщение luncher » 28.06.2009 00:40

    настраиваю веб сервер на основе фри 7.1, поставил апач и пхп,запустил,все прекрасно работает. Хотел поставить еще mysql, для его поддержки, насколько я помню, нужно разкоментировать какуето строку в php.ini.Ведь так? Но вот столкнулся с проблемой — нету нигде php.ini я уже и через поиск искал и ручками просто нету!
    Подскажите пожайлуста что делать и как включить поддержку mysql ?

    Re: нет php.ini

    Сообщение VarLog » 28.06.2009 01:02

    Я собирал php вручную. И в первый раз столкнулся с такой же проблемой.
    Проверьте, скомпилировал ли ваш php с опцией —with-config-file-path

    varlog:·> php-config |grep with-conf --configure-options [--prefix=/opt/apache2 --sysconfdir=/etc [b]--with-config-file-path=/etc/apache [/b]--with-openssl --with-exif --enable-exif --with-png --with-apxs2=/opt/apache2/sbin/apxs --enable-force-cgi-redirect --enable-discard-path --enable-bcmath --with-bz2 --enable-calendar --enable-dba --enable-exif --enable-ftp --with-gettext --enable-mbstring --with-ncurses --with-readline --with-gmp --with-mysql=shared,/opt/mysql --with-xml --with-regex=php --enable-shared --enable-mysql --with-gdbm --with-jpeg-dir --with-png-dir --with-zlib-dir --with-ttf --with-freetype-dir --with-zlib]

    upd: Также нужно естественно проверить опцию —with-mysql. У меня, как видите, прописан путь к установленному mysql и указана сборка shared модулей

    Источник

    Where is my PHP php.ini Configuration File Located?

    PHP php.ini Configuration File location

    In this article, we will guide you on a treasure hunt to find the php.ini configuration file, unravel its mysteries, and unlock the full capabilities of your PHP environment. Whether you are a seasoned PHP developer or a newcomer to the world of web development, understanding the ins and outs of this essential configuration file will make your journey smoother and your projects more efficient. So, let’s embark on this exciting quest to locate and master the php.ini file!

    Method 1

    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 .

    Load this file in your browser, press CTRL + F (or Command + F on Mac) 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

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

    Or in Windows Command Line:

    The result should be something like this:

    In the above example, we can see that the PHP install is located in /etc/php/8.1 . Note that there are three different configuration files you should we aware of:

    CLI

    /etc/php/8.1/cli/php.ini is for the CLI PHP program. Changes to this config file will only affect PHP as it runs in the terminal – it will NOT affect the web server.

    Apache

    /etc/php/8.1/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.

    Nginx or Apache with PHP-FPM

    /etc/php/8.1/fpm/php.ini is a fastcgi-compatible ‘wrapper’ for PHP processing. This is the one you need to edit if you’re using the Nginx web server or Apache with PHP-FPM.

    Method 3

    Using the locate command in Linux,. If it’s not already installed, run sudo apt update && sudo apt install mlocate .

    You should see a list of php.ini files here. Try editing one of them and restarting you web server to see if makes the required changes.

    Editing php.ini in Linux

    Apache

    On Apache, php.ini is usually located in /etc/php/8.1/apache2/php.ini . Replace 8.1 with your own version, e.g, php5.6 , php7.4 , etc.

    However, if you are using PHP FPM, it may be located in /etc/php/8.1/fpm/php.ini . Replace 8.1 with your own version, e.g, php5.6 , php7.4 , etc.

    To save file and exit, press CTRL + X , press Y and then press ENTER

    You must restart Apache after altering php.ini .

    If you are using PHP-FPM, you must restart that service. Replace php8.1 with your own version, e.g, php5.6 , php7.4 , etc.

    Nginx or Apache with PHP-FPM

    Nginx uses PHP FPM and php.ini is usually located in /etc/php/8.1/fpm/php.ini . Replace 8.1 with your own version, e.g, php5.6 , php7.4 , etc.

    Save and exit (press CTRL + X , press Y and then press ENTER )

    You must restart Nginx after altering php.ini .

    Older Versions

    For versions of Ubuntu lower than 16.04, /etc/php/5.6/ , /etc/php/7.0/ , /etc/php/7.1/ , and so on, are replaced by /etc/php5/ and so on. Otherwise, these paths remain accurate.

    Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

    p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

    No replies yet

    Join the full discussion at the DevAnswe.rs Forums →

    2 replies

    Leave a reply Cancel reply

    Very good… this information saved me!

    Источник

    Читайте также:  Где этот файл functions php
    Оцените статью