Php ini in xampp windows

ButlerCC Webhosting

This guide is intended to help you configure PHP for your local test server, and includes details for configuring PHP in XAMPP for both Windows and Mac OSX. Before you configure your php.ini file, you should first check your current settings and note the settings you need to change.

This table contains the recommended test server settings for PHP Core and Date directives for XAMPP (both Win and Mac).

Recommended Test Server Settings for PHP

Directive Local Value
allow_url_fopen On
allow_url_include Off
display_errors On
error_reporting 32767
file_uploads On
log_errors On
short_open_tag Off
upload_tmp_dir (Win) C:\xampp\tmp
(OS X) /Applications/XAMPP/xamppfiles/temp
date section
Default timezone
America/Chicago

Check Your PHP Settings with XAMPP:

  1. Open your XAMPP Control Panel (Manager-OSX) and Start the Apache server.
  2. In a browser, type http://localhost in the address bar to open the XAMPP dashboard page.
  3. Click PHPInfo in top navigation bar to display your current settings. The PHP Core and Date directives sections are the ones to focus on.
    XAMPP Start Page
  4. Compare your Core and date values to those in the recommended test server settings for PHP Core table and note the ones that need to be changed. Your PHP directives should look similar to the old screenshot below.
    PHP Info
  5. Open XAMPP Control Panel and Stop Apache server before editing PHP directives.

Where Is My php.ini File?

  • In XAMPP (Windows), the php.ini file is in the C:\xampp\php folder.
  • In XAMPP (Mac OSX), the php.ini file is in the /Applications/XAMPP/xamppfiles/etc folder.

Tips Before Editing php.ini File

Important points BEFORE editing your php.ini file:

  1. IMPORTANT! Open your XAMPP control panel and Stop Apache server before editing the php.ini file.
  2. Make a backup copy of the php.ini file before editing in case anything goes wrong (Name the backup copy php.ini.bak or something similar).
  3. The php.ini file is huge—use a text editor with line numbering, like Brackets (or Notepad++ for Win).
  4. Lines that begin with a semicolon (;) are comments and are ignored by PHP.
Читайте также:  Как поставить на фон картинку в HTML

Modify php.ini for XAMPP 7.4.8

In this version of the php.ini file, there are only two directives that must be modified. (Three directives in Mac OS X) However, you should still verify all the following directives are correct in your php.ini file. Directives in the following table are organized by line number.

  1. Open your php.ini file in Brackets (or other text editor with line numbering) and make the necessary changes.
  2. (Mac OS X only) Line 228 (short_open_tag) should be as follows:
    short_open_tag = Off
  3. Line 463 or 516 (error_reporting) should be as follows: (Note: the value is case sensitive so be sure to type in all caps. Use the pipe character SHIFT + \ for separator.)
    error_reporting = E_ALL | E_STRICT
  4. Line 1969 or 1040 (date.timezone) should be as follows:
    date.timezone = America/Chicago
  5. Save and close the php.ini file.
  6. In XAMPP Control Panel, restart your Apache server.
  7. To check the changes to your PHP configuration settings, type http://localhost in address bar of a browser to open the XAMPP dashboard.
  8. In the XAMPP dashboard, click PHPinfo link to display your current settings. Compare your values to the Recommended PHP Core directives table.
  9. When your php.ini file is configured correctly, you’re ready to work on projects in your htdocs directory.
    • c:\xampp\htdocs (Win)
    • /Applications/xampp/htdocs (Mac OSX)
  10. (Optional) If you want to use PHP includes and site root relative links in your projects, review Setup Virtual Hosts with XAMPP.

Disclaimers: Butler is an “Equal Opportunity Employer/Program” and “Auxiliary Aids and Services are available upon request.”

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Источник

Как найти файл php.ini (xampp)

Я использую сервер xampp для разработки PHP и хочу отредактировать файл php.ini ; где я могу его найти?

Для Windows вы можете найти файл в C:\xampp\php\php.ini -Folder (Windows) или в etc -Folder ( в папке xampp).

В Linux большинство дистрибутивов помещают фонарь под /opt/lampp , поэтому файл можно найти в /opt/lampp/etc/php.ini .

Его можно редактировать с помощью обычного текстового редактора.

в этом контексте они могут быть заменены друг на друга.

Напишите следующее внутри phpini_path.php (или AnyNameAsYouLike.php ) и запустите его в браузере.

Среди других параметров вы получите параметр Loaded Configuration File значение которого представляет собой путь к php.ini на сервере.

Местоположение php.ini зависит от операционной системы сервера:

Windows (с установкой Xampp) :

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

моя ОС – ubuntu, XAMPP установлен в /opt/lampp , и я нашел php.ini в /opt/lampp/etc/php.ini

Читайте также:  Php thread safe non thread safe iis

Поместите скрипт где-нибудь в свой корень документа

Среди прочего, вывод функции скажет вам, какие php.ini s разбираются до того, как скрипт был выполнен.

Если вы используете разные инсталляторы, вы можете получить больше одного файла php.ini на вашем hdd, что может повлиять на ваше здравомыслие через некоторое время.

Найдите свой hdd для «php.ini», если на нем больше одного.

Еще одним безопасным шагом является запоминание того, чтобы всегда перезапускать сервер (apache) после изменения значения в php.ini.

в моем случае он присутствует как «php.ini-development» и «php.ini-production» в папке php

Я запускаю LAMP на Debian и моем:

В документации http://www.apachefriends.org/en/xampp-windows.html (раздел «Файлы конфигурации» в нижней части страницы): \ xampp \ php \ php.ini

как указал KingCrunch, используя phpinfo, вы можете увидеть, какой файл конфигурации находится в действии в строке «Загруженный файл конфигурации». в моем случае in был в C: \ xampp \ apache \ bin, обратите внимание, что есть php.ini также в C: \ xampp \ php, который, кажется, избыточен и не имеет значения

Я использую xampp с PHP 7. вы можете попробовать искать php.ini в

Если у вас несколько запущенных php-версий (xampp и т. Д.), Я считаю, что проще всего использовать:

из командной строки. В окнах: либо после нажатия кнопки « Shell в xampp, либо непосредственно в обычном cmd чтобы найти «глобальную» версию php. С глобальным я имею в виду версию, на которую ссылаются переменные среды.

Источник

How to change PHP version in XAMPP for Windows

Image of PHP 7

Have you ever wondered how to upgrade or downgrade your PHP version in XAMPP without having to install another XAMPP software?, Well i have and from most answers i saw online, the best option was to download an updated version of XAMPP, but looking at it, i knew there had to be a better way so i made some research and was able to figure it out. In this article, i would show you how i changed my PHP version from 7.4.15 to 8.0.19. This is a screenshot of my current PHP version If you don’t know your current PHP version, you can use this link to check it.

STEP 1

PHP non thread safe version

Download the PHP version you want to use, you can find the PHP version you want to download from PHP’s download website for windows, but there is something you need to know before downloading any package, the download for a PHP version exists in 2 types — thread safe and non thread safe. Since you are using PHP with XAMPP, you are going to download the non-thread safe version because there is an apache file it has that would be used to configure XAMPP with PHP. After locating it, download the zip file. If you are running on a 32-bit system, download the non-thread safe version labelled with x86.

Читайте также:  Отступы в тексте

STEP 2

Apache file for XAMPP configuration

After you have downloaded it, extract the zip file and rename the extracted folder to «php», open the folder to find the apache file i mentioned in step 1 as shown in the image below. Once you have seen it, move the php folder to your xampp folder. Remember to make sure the current php folder in the XAMPP folder is either removed or renamed to something else so that the name won’t conflict with the one you are moving.

STEP 3

After moving the php folder into the XAMPP folder, open the folder and look for the php.ini config file. Whenever you download a PHP package, the php.ini file comes in two parts, php.ini-development and php.ini-production. These two config files represent the settings running on your development and production environments. Since you are using XAMPP, you would be using the development config file, so rename that config file to php.ini.

STEP 4

Open your XAMPP control panel. Under the actions option for Apache, look for the config button, click on it and select the Apache (httpd-xampp.conf) config file to open it. This is the file that XAMPP uses to configure PHP properly, look for the following:

LoadFile "C:/xampp/php/php7ts.dll" LoadModule php7_module "C:/xampp/php/php7apache2_4.dll" 

NOTE — Search everywhere in the file for «php7_module» and change it to «php_module» as you might need to change it in some places.

STEP 5

After you have done all this, save the changes and restart your server, go back to this url and confirm that your PHP version has changed. if everything was done correctly, you should see that you have successfully changed your PHP version!

PHP version 8 image

Very easy and convenient. You can agree it is really not difficult to change your PHP version in XAMPP as it is quite simple to do. Connect with me on twitter and linkedin to find out more about me and my work.

Источник

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