PHP 5: Scripting server language in Apache

PHP ins a Server Side Script Language, then it is executing in server, and return an HTML file to the web browser.

We will to install PHP5 over Apache, for our fauvorite distro, Debian Etch.

Installing with apt:

elite:~# apt-get install php5 php5-common libapache2-mod-php5 php5-gd php5-imap php5-ldap php5-mysql php5-odbc php5-snmp
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Se instalarán los siguientes paquetes extras:
  apache2-mpm-prefork libc-client2002edebian libmysqlclient15off libt1-5 libxml2 mlock mysql-common odbcinst1debian1 unixodbc
Paquetes sugeridos:
  php-pear uw-mailutils libmyodbc odbc-postgresql libct1
Paquetes recomendados
  xml-core
Los siguientes paquetes se ELIMINARÃN:
  apache2-mpm-worker
Se instalarán los siguientes paquetes NUEVOS:
  apache2-mpm-prefork libapache2-mod-php5 libc-client2002edebian libmysqlclient15off libt1-5 libxml2 mlock mysql-common odbcinst1debian1
  php5 php5-common php5-gd php5-imap php5-ldap php5-mysql php5-odbc php5-snmp unixodbc
0 actualizados, 18 se instalarán, 1 para eliminar y 1 no actualizados.
Necesito descargar 6963kB de archivos.
Se utilizarán 14,7MB de espacio de disco adicional después de desempaquetar.
  • In php.ini, we open the error debug:
  • display_errors = On
    log_errors = On
  • Restart apache: /etc/init.d/apache2 restart

Testing the good work of our server:

  • Make a test page /var/www/index.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <TITLE>LAMP Server Test</TITLE>
</HEAD>
<BODY>
<h3>
<?
echo "PHP test, we wil make s phpinfo() to see if it works, with this test we can test if MySql runs:";
?>
</h3>
<? phpinfo(); ?>
</BODY>
</HTML>

If our web root directory is /var/www we can see this page with PHP workin in the link: http://www.midominio.com.

I you want to study in depth, you can see my usual table:

Origin http://www.php.net/
Repository http://www.php.net/downloads.php
Package apt 5.2.0-8
Documentation (Spanish) http://www.php.net/manual/es/
Documentation (English)
Files Configuration: /etc/php5/apache2/php.ini
Log: /var/log/apache2

Leave a Reply

Your email address will not be published. Required fields are marked *