How to check php info

php Version Check

How to Check if php is installed on the Web Server
and how to Detect the php Version using phpinfo()

php is installed on most hosted Linux based web servers, but it’s also available for Windows based web servers.

Check if php is installed on your Web Server

1. Create a text file, e.g. using notepad or any other text editor:

2. Save the file as «version.php». Make sure, that the extension is .php (not .txt)

3. Upload the file to the root of your web

4. Open the file in your web browser, e.g. http://www.yourdomain.tld/version.php

5. Delete the file on your web server after you are done. You should be the only one seeing this information!

How to detect the php Version?

Run the phpinfo() script above.
It contains much more information, like:

  • php Version
  • Build Date
  • Configuration
  • .
  • Installed php Modules
  • php Variables

Multiple php Versions on the same Server

Some web server are pre-configured to run e.g. php5 and php8 at the same time, to ensure compatibility with older scripts and CMS systems.
If you web server is configured for multiple php versions, select the php version by using e.g.

somescript.php5 // for php5 (old) scripts
somescript.php8 // for php8 scripts
somescript.php // for the default php version

The default php version depends either on your php configuration or on your hosting package.

Disclaimer: The information on this page is provided «as is» without warranty of any kind. Further, Arclab Software OHG does not warrant, guarantee, or make any representations regarding the use, or the results of use, in terms of correctness, accuracy, reliability, currentness, or otherwise. See: License Agreement

  • ©1997-2023 Arclab®. All other trademarks and brand names are the property of their respective owners.
  • info_outline
  • fingerprint Cookies & Privacy

Источник

phpinfo

Выводит большое количество информации о текущем состоянии PHP. Сюда входит информация о настройках компиляции PHP, о расширениях, о версии, информация о сервере и среде выполнения (если PHP компилировался как модуль), окружении PHP, версии ОС, о путях, об основных и локальных значениях настроек конфигурации, о HTTP заголовках и лицензии PHP.

Читайте также:  Java jdk contains jre

Так как каждая система имеет свои особенности, phpinfo() используется в основном для проверки настроек конфигурации и для просмотра доступных предопределенных констант в данной системе.

phpinfo() также используется в целях отладки, так как содержит все EGPCS (Environment, GET, POST, Cookie, Server) данные.

Список параметров

Вывод функции можно настраивать, передавая битовую маску из одной или более приведенных ниже констант (constants). Эта маска передается в качестве необязательного аргумента what . Отдельные константы или битовые значения можно комбинировать с помощью оператора или.

Настройки phpinfo()

Имя (константа) Значение Описание
INFO_GENERAL 1 Строка конфигурации, расположение php.ini , дата сборки, Web-сервер, Система и др.
INFO_CREDITS 2 Разработчики PHP. См. также phpcredits() .
INFO_CONFIGURATION 4 Текущие значение основных и локальных PHP директив. См. также ini_get() .
INFO_MODULES 8 Загруженные модули и их настройки. См. также get_loaded_extensions() .
INFO_ENVIRONMENT 16 Информация о переменных окружения, которая также доступна в $_ENV .
INFO_VARIABLES 32 Выводит все предопределенные переменные из EGPCS (Environment, GET, POST, Cookie, Server).
INFO_LICENSE 64 Информация о лицензии PHP. См. также » license FAQ.
INFO_ALL -1 Выводит все приведенное выше.

Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

Список изменений

Версия Описание
5.5.0 GUID логотипов были заменены на URI данных, и отключение expose_php теперь не влияет на результат phpinfo(). Список авторов теперь также встроен в вывод.
5.2.2 Добавлен вывод информации о загруженном конфигурационном файле. Ранее выводился только путь к конфигурационному файлу (php.ini).

Примеры

Пример #1 Пример использования phpinfo()

// Показывать всю информацию, по умолчанию INFO_ALL
phpinfo ();

// Показывать информацию только о загруженных модулях.
// phpinfo(8) выдает тот же результат.
phpinfo ( INFO_MODULES );

Примечания

Замечание:

В версиях PHP до 5.5, часть информации не выводится, если настройка expose_php установлена в off. Это PHP и Zend логотипы и информация о разработчиках.

Замечание:

В режиме CLI phpinfo() выводит обычный текст вместо HTML.

Смотрите также

  • phpversion() — Выдает текущую версию PHP
  • phpcredits() — Выводит список разработчиков PHP
  • php_logo_guid() — Получение guid логотипа
  • ini_get() — Получает значение настройки конфигурации
  • ini_set() — Установка значения настройки конфигурации
  • get_loaded_extensions() — Возвращает массив имен всех скомпилированных и загруженных модулей
  • Предопределенные переменные

Источник

LINUX — HOW TO CHECK PHP CONFIGURATION — PHPINFO()

Linux - How to check PHP configuration - phpinfo()

Every web application or site has important PHP version, extensions and configuration requirements installed on the server. It is recommended to make sure that all necessary PHP settings are installed on your server.

The content of the article:

1. The phpinfo() function.

In the first version of checking the php configuration, the special php function phpinfo() will help us. To use this function, you need to create a file with any name with the .php extension in the root directory of the site, in which you place the code below and save the file.

Читайте также:  Read com port java

After saving the file, enter the domain and name of the created file in the browser, and as a result, if PHP is activated on your server, a page with its version and all existing parameters will be displayed.

php info

2. PHP console utility.

The next check option we can use is a special php utility that is installed on your server along with all php components.

The first command shows the PHP version on the server and the compilation time.

php info

The second command shows all installed modules in PHP.

php info

The last command which shows detailed information about PHP.

php info

Thank you all, I hope my article was of some help to you.

Источник

How to Check PHP Version

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 14 people, some anonymous, worked to edit and improve it over time.

This article has been viewed 925,834 times.

If you’re interested in implementing new features on your website, or are trying to pinpoint a bug, you may need to check the version of PHP that your server is currently running. You can check the version by running a simple PHP file on your webs server. You can also check what version is installed on your local computer using the Command Prompt or Terminal.

Web Server

Image titled 2232402 1 1

Open a text or code editor. You can use Notepad or TextEdit. Don’t use a word processor such as Microsoft Word.

Image titled 2232402 2 1

Enter the following code. This small piece of code will return the PHP version information when it is run on your web server. [1] X Research source

 echo 'Current PHP version: ' . phpversion(); ?> 

Image titled 2232402 3 1

Save the file as a PHP file. Click «File» → «Save as» and then give the file a name. Add the .php extension to the end of the file name. Name it something simple, like version.php .

Image titled 2232402 4 1

Create a more detailed report (optional). The file above will output your current PHP version number, but if you want more information, such as system info, build dates, available commands, API information, and more, you can use the phpinfo() command. Save the file as info.php .

Image titled 2232402 5 1

Image titled 2232402 6 1

Local PHP Version

Image titled 2232402 7

  • Windows — Press ⊞ Win + R and type cmd .
  • Mac — Open Terminal from the Utilities folder.
  • Linux — Open Terminal from the dash, or by pressing Ctrl + Alt + T .

Image titled 2232402 8

Image titled 2232402 9

  • Find the location of your php.exe file. This is usually C:\php\php.exe , but you may have changed this during installation.
  • Type set PATH=%PATH%;C:\php\php.exe and press ↵ Enter . Change the actual location if yours is different.
  • Run php -v again. You should now be able to see the version number.

Community Q&A

When I use the PHP -v command it says ‘PHP’ is not recognized as an internal or external command, operable program or batch file. Why?

This is caused by PHP not being in your PATH. Follow the directions under Method 2 for setting your PATH variable.

Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow

`phpinfo` and `php -v` show different versions of PHP. How do you resolve this and change php -v to the desired version?

`phpinfo` returns the version being used by your web server. `php -v` is the version installed in your PATH (where the operating system looks for programs to run from the command line). Check your web server setup, to find the path of the PHP interpreter it is using. Then, either invoke it by entering the full path (like C:\Programs Files\php.exe or /usr/bin/php), or add its parent directory to the top of your path variable (as described in the article. In Linux, the php command may be symlinked to a specific version, while the web server invokes another version. You’ll need to modify the symlink, or run the command for your distro to select an alternative.

Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow

Источник

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