miércoles, 16 de septiembre de 2009

Averiguar de forma rápida si se está leyendo php.ini y desde dónde.

Una forma rápida que he averiguado para saber si apache2 está leyendo el fichero de configuracion de PHP llamado php.ini es creando un archivo .php con cualquier nombre con el siguiente contenido:
<?php
phpinfo();
?>
De esta forma llamamos a la función phpinfo() que nos dará todo tipo de detalles acerca de nuestro servidor Apache, MySQL, PHP, variables y demás.
Una vez guardado el fichero en algún sitio de Apache que tengamos acceso desde fuera, ejecutamos en un navegador. http://IP_servidor_Apache/info.php.
Si tenemos Apache bien configurado para ejecutar código php, nos aparecerá una tabla generada por php con toda la información de nuestro servidor.
En torno a la 6ª fila aprox. veremos algo similar a esto: Configuration File (php.ini) Path y debajo algo parecido a esto: Loaded Configuration File 

Pues bien, el primero nos dice desde dónde se está cargando el fichero php.ini (por lo que si anda perdido por algún otro lugar, deberemos copiarlo ahí si queremos que lo ejecute Apache al iniciar ) y el 2º nos dirá si lo está cargando o no. Si pone (none) como es de suponer no está encontrando ningún php.ini y si no, pues seguramente tenga el mismo dato que el anterior.

Find out quickly if php.ini is being read and from where.

A quick way I found out to see if apache2 is reading the PHP configuration file called php.ini  is creating a file with php extension with any name with the following contents:

<?php
phpinfo();
?>

This calls to the phpinfo() function which will give you a fully detailed file of your server, Apache, MySQL, PHP, and other variables.

After you save the file somewhere on Apache that you have access from outside, run in a browser. http://Apache_server_IP_address/info.php.

If you have Apache properly configured to run php code, you'll see a table generated by php with all the information about our server.

Around the 6th row approximately you'll see something like this: Configuration File (php.ini) Path and below something like this: Loaded Configuration File

Well, first row show you from where the server is loading the php.ini file (if it isn't there, you'll have to copy it to the appropriate location) and the second row will tell you if it's being loaded or not. If it shows (none) that means that the server isn't finding any php.ini. If it's working well you'll see the same data as previous row.

1 comentario:

Alberto dijo...

Si solo quieres mirar que php.ini se está utilizando es también puedes usar esto:



Un saludo :)