Wednesday, January 23, 2013

Ubuntu: LAMP Memoir

Installing

sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
sudo apt-get install libapache2-mod-auth-mysql

Restarting Service

sudo service apache2 restart
sudo service mysql restart

Interacting with MySQL

mysql -p 
mysql -p db_name < import.sql

Installing phpMyAdmin

sudo apt-get install phpmyadmin

Let Apache know about phpMyAdmin:

sudo gedit /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf

Use php Mail with PEAR

If you see Failed opening required 'Mail.php', this means pear/Mail is not installed.

wget http://pear.php.net/go-pear.phar
sudo php go-pear.phar
sudo pear install Mail
sudo pear install Net_SMTP

Configure that base path be /usr/share/pear so that you don't need to change the include path. On wrong installation, uninstall it this way

sudo pear uninstall pear

Troubleshooting

After any change, restart service to see effects.

  • Program halts when accessing database: the module php5-mysql may be not installed
  • mysql_connect gives an empty output, this may be caused by a not guaranteed permission. Try use root or update the user with proper privilege.

No comments:

Post a Comment