jueves, 25 de agosto de 2011

configurar servidor web apache + php con soporte para mysql en servidor independiente

sudo apt-get install apache2 (sudo apt-get install apache2-mpm-worker libapache2-mod-fcgid)

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart

Note que si apache esta bien instalado usted puede omitir la primera linea. Sus archivos web podrá encontrarlos en /var/www/

donde se debe guardar el archivo info.php con



soporte para mysql

para ver que está disponible para php5
apt-cache search php5

Edit PHP Configuration to Work With MYSQL (Ubuntu Dapper)

In Dapper Drake, "extension=mysql.so" and "extension=mysqli.so" are enabled in the php.ini file out-of-the-box. However, sometimes php is not looking for those files in the right directory. You have then to move your files or modify the php.ini configuration.:

First solution

locate the directory where the extension files are placed:

locate mysql.so

(change mysql.so in mysqli.so if you want to install the mysqli functions)

-then modify the php.ini file to indicate the right place for the extension directory:

$ gksudo "gedit /etc/php4/apache2/php.ini"

or if you are using php5

$ gksudo "gedit /etc/php5/apache2/php.ini"

Look for the 'extension_dir' property, and set it to the directory where you found the mysql(i).so file:

extension_dir= "/usr/lib/php5/20051025/"

Restart apache, and test if your mysql(i) functions are working.

apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

/etc/init.d/apache2 restart

Como parte final, es recomendable editar el archivo /etc/php5/apache2/php.ini y verificar las recomendaciones sobre un servidor de producción y uno de desarrollo ej.

; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = off