Thursday, 14 August 2008

Setting-up of PHPMyadmin


The phpmyadmin configuration file is located at: /etc/phpmyadmin folder. To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf


Now restart Apache:


/etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin That's it! MySQL and phpMyAdmin are ready. Log in with your mysql root password and create users to connect to database from your php script.



Installing MySQL and phpMyAdmin on debian platform

To install MySQL,

sudo apt-get install mysql-server

If this is a clean installation of MySQL, it will prompt you to set your root password. Make sure that you type it correctly, as it will only ask you once. If you've upgraded, or installed MySQL before, it may not prompt you for a password.

Testing MySQL

Once MySQL is finished installing, we can test MySQL by connecting to it, using...

mysql -uroot -pyourpassword


After filling in your own password after -p, you'll see a MySQL prompt.
That's it, you're done! You can type 'exit' to get out of MySQL.

Installing phpMyAdmin

if you want to install phpMyAdmin to administrate your MySQL, you can type...

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin


Again, like MySQL, if this is a clean installation, it will ask you to choose a webserver to configure automatically. If you have had phpMyAdmin installed before, it won't prompt you to choose. You can use the space bar to select apache2 and then enter.

Once that's finished, restart it one more time and enter the webserver as apache2.


Adept gives a message that the packaging database is locked by another program


Try

1. sudo dpkg --configure -a

else

2. ps -ewf| grep adept|grep -v grep|awk '{print $2}'

This will list all process being used by adept, one per line. Next kill these processes:

sudo kill -9

else Use this command....

3. $ sudo fuser -vki /var/lib/dpkg/lock

This will ask you if you want to kill the process using the file. Now you can run:

$ sudo dpkg --configure -a

to make sure all packages are fully installed.


Drupal 5.x and Clean URLs on Ubuntu


The default unclean URLs that Drupal provides with question marks lurking around, could be annoying. But it does offer an option to have clean URLs.

Step 1

Check whether the rewrite module for your apache is enabled. Assuming you have an apache2 installation, you can do this by

ls /etc/apache2/mods-enabled/

If you don’t find rewrite.load, it means that the rewrite module is not enabled. Drupal’s clean URLs feature requires this module to be enabled. In ubuntu / a debian based machine try..

sudo a2enmod

This will ask you the enter the module to be enabled. Type

rewrite and press enter

This can also be done as

sudo a2enmod rewrite

This can also be done like this (say for a non-Debian based OS):

cd /etc/apache2/mods-enabled

sudo ln -s ../mods-available/rewrite.load rewrite.load

There! We have enabled the rewrite module for apache.

Step 2
We have to edit /etc/apache2/sites-available/default. Look out for the following lines.


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny

Change AllowOverride None to AllowOverride All. Save the File.

Step 3
Make sure that the .htaccess file under your Drupal installation folder has the following lines


RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


Step 4

Restart the apache server sudo /etc/init.d/apache2 restart

Step 5
Go to your Drupal administration page for clean URLs and enable them.

Wednesday, 13 August 2008

Installing PHP5 for Apache2 on Ubuntu 8.04

PHP5 - Scripting Language
PHP is a general-purpose scripting language suited for web development. The PHP script can be embedded into HTML. This section explains how to install and configure PHP5 in Ubuntu System with Apache2 and MySQL.

Installation
To install PHP5 you can enter the following command in the terminal prompt:
sudo apt-get install php5 libapache2-mod-php5

You can run PHP5 scripts from command line. To run PHP5 scripts from command line you should install php5-cli package. To install php5-cli you can enter the following command in the terminal prompt:
sudo apt-get install php5-cli

You can also execute PHP5 scripts without installing PHP5 Apache module. To accomplish this, you should install php5-cgi package. You can run the following command in a terminal prompt to install php5-cgi package:
sudo apt-get install php5-cgi

To use MySQL with PHP5 you should install php5-mysql package. To install php5-mysql you can enter the following command in the terminal prompt:
sudo apt-get install php5-mysql

To verify your installation, create a php file named info.php and write the following script into it.
print_r (phpinfo());
?>

If you need to have universe source list in your sources.list file
For php4 support
sudo apt-get install libapache2-mod-php4 php4-cli php4-common php4-cgi
For php5 support (as discussed earlier)
sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

Next open /etc/apache2/apache2.conf file and check the index files are correct
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
If you want to enable some Apache modules (SSL, rewrite, suexec, and include)
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
Restart Apache to make sure all is well.
sudo /etc/init.d/apache2 restart





Apache2 on Ubuntu

Apache is the most commonly used Web Server on Linux systems. Web Servers are used to serve Web Pages requested by client computers. Clients typically request and view Web Pages using Web Browser applications such as Firefox, Opera, or Mozilla.

Installation
To install Apache2:

At a terminal prompt enter the following command:
sudo apt-get install apache2

Enter the user password on promt and confirm on question promt.


To stop/start apache2 write:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

Your default public folder shall be in: /var/www/ If everything is OK you should see an ordinary HTML page when you type: http://localhost in your browser.

Monday, 11 August 2008

How to reset MySQL password.

Follow the steps below:
  1. Stop the mysqld daemon process.
  2. Start the mysqld daemon process with the --skip-grant-tables option.
  3. Start the mysql client with the -u root option.
  4. Execute - UPDATE mysql.user SET password=PASSWORD('password123) WHERE user='root';
  5. Execute the FLUSH PRIVILEGES; command.
These steps reset the password for "root" account to "password123".