Logo
You
Code

Obtener informacion sobre PHP desde la consola

Autor YouCode - http://www.youcode.com.ar/php/obtener-informacion-sobre-php-desde-la-consola-372

Algunas veces necesitamos saber que tiene instalado php, veremos algunos ejemplos desde la consola.

Versión de PHP instalada:

$ php -v

PHP 5.X.X (cli) (built: Jun 18 2009 18:16:19)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager vX.X.X, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer vX.X.X, Copyright (c) 1998-2007, by Zend Technologies

Módulos de PHP instalados

$ php -m
[PHP Modules]
bcmath
calendar
ctype
curl
date
dom
filter
ftp
gd
...
...
...
[Zend Modules]
Zend Extension Manager
Zend Optimizer

Información general PHP


esto seria lo que nos da phpinfo()
$ php -i
phpinfo()
PHP Version => 5.X.X

System => Linux  #1 SMP Thu May 7 10:39:21 EDT 2009 iX86
Build Date => Jun 18 2009 18:14:47
Configure Command =>  './configure'  '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable
-mbstring' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--wit
Server API => Command Line Interface
Virtual Directory Support => disabled
....
....
....
This program makes use of the Zend Scripting Language Engine:
Zend Engine vX.X.X, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer vX.X.X, Copyright (c) 1998-2007, by Zend Technologies
....
....
....

Mostrar archivos de configuración cargados y sus rutas

$ php --ini

Configuration File (php.ini) Path: /xxx/xxx/xx
Loaded Configuration File:         /xxx/xxx/xxx/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Mostrar configuración de un módulo/extensión

$ php --ri openssl
openssl

OpenSSL support => enabled
OpenSSL Version => OpenSSL X.X.Xe-fips-xxx 01 Jul 2008

Mostrar información de un módulo/extensión

$ php --re openssl
Extension [
 extension #35 openssl version  ] {

  - Constants [36] {
    Constant [ string OPENSSL_VERSION_TEXT ] { OpenSSL X.X.Xe-fips-xxx 01 Jul 2008 }
    Constant [ integer OPENSSL_VERSION_NUMBER ] { 9469999 }
    Constant [ integer X509_PURPOSE_SSL_CLIENT ] { 1 }
    Constant [ integer X509_PURPOSE_SSL_SERVER ] { 2 }
    Constant [ integer X509_PURPOSE_NS_SSL_SERVER ] { 3 }
    Constant [ integer X509_PURPOSE_SMIME_SIGN ] { 4 }
    Constant [ integer X509_PURPOSE_SMIME_ENCRYPT ] { 5 }
    Constant [ integer X509_PURPOSE_CRL_SIGN ] { 6 }
    Constant [ integer X509_PURPOSE_ANY ] { 7 }
    Constant [ integer OPENSSL_ALGO_SHA1 ] { 1 }
    Constant [ integer OPENSSL_ALGO_MD5 ] { 2 }
    Constant [ integer OPENSSL_ALGO_MD4 ] { 3 }
    Constant [ integer OPENSSL_ALGO_MD2 ] { 4 }
    Constant [ integer OPENSSL_ALGO_DSS1 ] { 5 }
...
...
...
http://www.youcode.com.ar/php/obtener-informacion-sobre-php-desde-la-consola-372