Apache, LAMP, MySQL, php

Building a LAMP server in Linux

In the previous week I had configured LAMP in our server. Being a person who had worked in php for some months, actually I was not much aware of setting this in Linux. On my php days I was only using the easy windows bundle “phptriad” for coding… Being a man who is not much familiar with Linux, this installation was not much easy for me. The one main problem occurred is with the compatibility issue of the latest PHP and MySQL downloads.

1. Remove previous RPM Versions of the Applications

rpm -qa | grep -i apache
rpm -qa | grep -i httpd
rpm -qa | grep -i php
rpm -qa | grep -i mysql

2. Get the Source Code for all Applications from their respective sites

3. Unpack the Source Code

tar zxf php-x.x.x.tar.gz
tar zxf apache_x.x.xx.tar.gz
tar zxf mysql-x.x.xx.tar.gz

This should leave you with the following directories:

/usr/local/src/php-4.4.2
/usr/local/src/apache_1.3.34
/usr/local/src/mysql-4.0.26

4. Build and Install MySQL

cd /usr/local/src/mysql-x.x.xx

chown -R root.root *

make clean

./configure \
–prefix=/usr/local/mysql \
–localstatedir=/usr/local/mysql/data \
–disable-maintainer-mode \
–with-mysqld-user=mysql \
–with-unix-socket-path=/tmp/mysql.sock \
–without-comment \
–without-debug \
–without-bench

then make && make install

5. Build and Install Apache (with DSO support)

cd /usr/local/src/apache_1.3.34

make clean

./configure \
–prefix=/usr/local/apache \
–enable-shared=max \
–enable-module=rewrite \
–enable-module=so

make && make install

6. Build and Install PHP

cd /usr/local/src/php-x.x.x

./configure \
–with-apxs=/usr/local/apache/bin/apxs \
–disable-debug \
–enable-ftp \
–enable-inline-optimization \
–enable-magic-quotes \
–enable-mbstring \
–enable-mm=shared \
–enable-safe-mode \
–enable-track-vars \
–enable-trans-sid \
–enable-wddx=shared \
–enable-xml \
–with-dom \
–with-gd \
–with-gettext \
–with-mysql=/usr/local/mysql \
–with-regex=system \
–with-xml \
–with-zlib-dir=/usr/lib

make && make install

cp php.ini-dist /usr/local/lib/php.ini
ln -s /usr/local/lib/php.ini /etc/php.ini

7. Edit the Apache Configuration File (httpd.conf)

To ensure your PHP files are properly interpreted, and not just downloaded as text files , add these lines to the respective location in the httpd.conf file. We can find the location by searching “AddType”.

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
AddType application/x-httpd-php .php .foo
AddType application/x-httpd-php-source .phps .phtmls
AddType application/x-httpd-php .php .htm .html

8. Commands to start, stop or restart apache

To start apache : /usr/local/apache/bin/apachectl start
To stop apache : /usr/local/apache/bin/apachectl stop
To restart apache : /usr/local/apache/bin/apachectl restart

Source: here
Technorati tags: Linux, LAMP, PHP, Apache, MySQL 

Advertisements
MySQL

MySQL: Backup and Restore

To take the entire backup of a database:
> mysqldump -u user_name -p database_name > dumped_file_name

To Restore the backup
> mysql -u user_name -p database_name < dumped_file_name

Technorati: Mysql

howto, Linux, MySQL

Uninstalling the Previous MySQL Installation in Linux

When we install the new version of mysql in linux then, if there is any old version is existing, it will show some conflict. So we have to remove the old files before proceeding further. The following commands will help you to do this.

# rpm -qa | grep -i mysql
libdbi-dbd-mysql-0.6.5-7
MySQL-python-0.9.1-9
perl-DBD-MySQL-2.9002-1
mod_auth_mysql-20030510-3
php-mysql-4.3.3-6
mysql-3.23.58-4
mysql-bench-3.23.58-4
mysql-server-3.23.58-4
freeradius-mysql-0.9.1-1
mysql-devel-3.23.58-4
qt-MySQL-3.1.2-14

You will want to uninstall any release of MySQL before continueing with the installation of latest MySQL version.

You can use RPM to uninstall the above packages as follows:

# rpm -e libdbi-dbd-mysql
# rpm -e MySQL-python
# rpm -e mod_auth_mysql
# rpm -e php-mysql
# rpm -e mysql-bench
# rpm -e mysql-server
# rpm -e freeradius-mysql
# rpm -e mysql-devel
# rpm -e mysql perl-DBD-MySQL MyODBC qt-MySQL

In addition to removing all MySQL packages, you will also want to remove any mysql group and user that may already be created. The following command will remove both the mysql group as well as the mysql group:

# userdel mysql

Reference here


Technorati : , ,

Database, MySQL, SQLyog, Tips

SQLyog: a MySQL front End

SQLyog is an all-round Management Tool (GUI / Frontend) for the MySQL database. It is supported MySQL versions from 3.23 to 5.1.x. I think SQLyog provides an efficient and intuitive User Interface for management of MySQL database. It is at the same time an easy-to-use tool for beginners and an efficient timesaver for MySQL power users – Developers and DBA’s as well.

From the starting of my career I have been using the “MySQLfront” as my GUI tool for MySQL. But SQLyog is much much better than this and I think its the time to change. From this September onwards this is released as Open Source under the GPL license. We can download SQLyog from here

Technorati tags: SQLyog, MySQL