Wednesday, June 20, 2018

Cloud Mind Set


Cloud Mind Set

       We can see the drastic changes from 2005 to now. For example if we take phone we can see the drastic changes in the hardware. It will come on by providing the creative and quality products.


  • Service Mindset 
  • Speed
  • Agility
  • Customer Focus
  • Innovation and Quality 
  • User-Experience

Tuesday, August 17, 2010

PHP "PCNTL" Module Recompilation steps

PHP "PCNTL" Module Recompilation steps :
========================================

Hi,

Please follow the below steps for recompiling "pcntl" Module while exact version of "PCNTL" PHP RPM package not available.

1) Go to PHP Source location

/root/php-5.2.13 or the source path of PHP package.

2) Then navigate to ext directory. This directory having all the php modules.

/root/php-5.2.13/ext/pcntl

3)Then execute "phpize" command in shell . This 'll create the required libries for compilation process.

output
======
[root@admin pcntl]# phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

4)Then Execute the ./configure

[root@admin pcntl]# ./configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable pcntl support... yes, shared
checking for fork... yes
checking for waitpid... yes
checking for sigaction... yes
checking for getpriority... yes
checking for setpriority... yes
checking for wait3... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged

5)[root@admin pcntl]# make

Build complete.
Don't forget to run 'make test'.

6) make test

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP : /usr/local/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.2.13
ZEND_VERSION: 2.2.0
PHP_OS : Linux - Linux admin.website.com.tw 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT 2010 x86_64
INI actual : /root/php-5.2.13/ext/pcntl/tmp-php.ini
More .INIs :
CWD : /root/php-5.2.13/ext/pcntl
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2010-08-18 04:22:01
=====================================================================
PASS Test pcntl wait functionality [tests/001.phpt]
PASS Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
PASS Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
PASS Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
=====================================================================
TIME END 2010-08-18 04:22:03

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 37
---------------------------------------------------------------------

Number of tests : 4 4
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 4 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken : 2 seconds
=====================================================================

We would like to send this report automatically to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose "s" to save the report to
a file that you can send us later.
Do you want to send this report now? [Yns]: y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text):

Posting to qa.php.net /buildtest-process.php

Thank you for helping to make PHP better.

7)Then you can find a file "pcntl.so" under the directory "/usr/lib64/php/modules/"

8)Then go to php source directory "/root/php-5.2.13 " then execute ./ configure command for enabling --enable-pcntl \ module
./ configure --enable-pcntl

./configure --enable-bcmath--enable-calendar--enable-exif--enable-ftp--enable-gd-native-ttf--enable-libxml--enable-magic-quotes--enable-mbstring--enable-sockets--prefix=/usr/local--with-apxs2=/usr/sbin/apxs--with-freetype-dir=/usr--with-gd--with-imap-ssl=/usr--with-jpeg-dir=/usr--with-kerberos--with-libxml-dir=/opt/xml2/--with-mhash=/usr/lib64/--with-curl=/usr/lib64/--with-gettext--with-mcrypt=/opt/libmcrypt/--with-mysql=/usr--with-mysql-sock=/var/lib/mysql/mysql.sock--with-openssl=/usr--with-openssl-dir=/usr--with-png-dir=/usr--with-ttf--with-xpm-dir=/usr/X11R6--with-zlib--with-zlib-dir=/usr--enable-pcntl

Then execute make and make test command.

9) Then add extension entry in php configuration file (php.ini)

vi /etc/php.ini
extension=pcntl.so

10) Restart Apache service

That's it . You can verify the phpmodules by executing the php -m command.

Monday, August 2, 2010

Check with the following things for analyzing server hacks in Linux server

Check with the following things for analyzing server hacks in Linux server
==========================================================================

1)Last command

2)Analyze the following logs
============================
apache error log
apache access log
var/log/messages
apache secure log

3) Verify all the ports

Analyze the following files
============================

/etc/userdomains
/etc/shadow
/etc/passwd
.bash history
/root/bash profile
lsattr

Tuesday, July 20, 2010

SSL certificates through cPanel

You can install/manage SSL certificates through cPanel very well. Please go through the following steps.

1.Login into the cPanel with appropriate login credentials.
2.Click "SSL/TLS Manager"
3.Now you can view/modify the "Private key, CSR, Certificates(.CRT)"
4.Then select 'Certificates (CRT) -> Generate, view, upload, or delete SSL certificates'
5.Remove the existing one(please take a copy of the certificate before delete it)
6.Paste your Certificate (.CRT) under the box "Upload a New Certificate -> Paste the crt below:"
7.Click "Upload" button.

Please generate new CSR through cPanel and submit it at your SSL provider to regenerate the certificate and follow the mentioned above steps to install the new SSL certificate.

Thursday, July 8, 2010

Domain migration in Linux server steps

Migration of domain from old server to new server
====================================================


1)Verify the Disk usage of particular account

root@host [/home]# du -sh road/
489M road/

2)Then Run pkgacct script:

root@host [/home]# /scripts/pkgacct road/
pkgacct started.
pkgacct version 8.3 - user : road/ - archive version: 3 - running with uid 0
warn [pkgacct] Invalid username to loadcpuserfile.
Unable to find domain name for road/

root@host [/home]# /scripts/pkgacct road
pkgacct started.
pkgacct version 8.3 - user : road - archive version: 3 - running with uid 0
Copying Reseller Config...Done
Copying Suspension Info (if needed)...Done
Copying SSL Certificates, CSRS, and Keys...Done
Copying Domain Keys....Done
Copying Counter Data....Done
Copying Bandwidth Data.......roadtomakkah.com...Done
Copying Dns Zones.......roadtomakkah.com...Done
Copying Mail files....Done
Copying frontpage files....Done
Copying proftpd file....Done
Copying www logs.............
Done
Copy userdata............
Copy custom virtualhost templates............
Done
Copying mailman lists....Done
Copying mailman archives....Done
Copying homedir.............
.........
.........
.........
.........
.........

Then move the particular file to /usr/local/apache/htdocs
mv cpmove-road.tar.gz /usr/local/apache/htdocs/
Change the cpmove-road.tar.gz ownership to nobody user



3)Using wget command download old server account to the new server

wget http://IP/cpmove-road.tar.gz
Move the downloaded file to home directory


4) Extract the downloaded file using restorepkg script
root@neigh [/home]# /scripts/restorepkg cpmove-road.tar.gz
Using cpmove archive
cPanel restorepkg 2
Force Mode: no
Reseller Privs Restore: yes

Searching /home....
Found cpmove-road.tar.gz !
Extracting tarball...................



5)Then we have to move mysql package

du -sh road_main/
76K road_main/
root@host [/var/lib/mysql]#

root@host [/var/lib/mysql]# mysqldump road_main > road_main.sql
mysqldump: Error: 'Table 'INFORMATION_SCHEMA.FILES' doesn't exist' when trying to dump tablespaces



root@host [/var/lib/mysql]# du -sh road_main.sql
8.0K road_main.sql
root@host [/var/lib/mysql]#

6) Then using server copy we are transfering the new dump file to the new server

scp road_main.sql root@IP:/var/lib/mysql


7)Go to new server and Extract the database using the followuing command

mysql road_main < road_main.sql

Compare the disk usage with the new server. ( This is for just verification )

root@neigh [/var/lib/mysql]# du -sh road_main
76K road_main
root@neigh [/var/lib/mysql]#



8)We have to connect mysql and have to give grant all privileges to Databases

Just Take DB, User information from the configuration file like configuration.php or some other files.

Search that information using the following command
grep databasename -lr *

Then Enter in to the corresponding file and take the corresponding information

########## Database Info ##########
$db_server = 'localhost';
$db_name = 'shopno_smf';
$db_user = 'shopno_admin';
$db_passwd = 'admin';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;
http://forums.mysql.com/read.php?11,240976


9) Then go Mysql prompt and select the particular database

Then give the grant all privileges to the user

GRANT ALL privileges ON DATABASE.* TO user@domain IDENTIFIED BY 'password'


10) Then check with domain functionality using temp URL
http://67.45.34.67/~account_name

Saturday, July 3, 2010

Building a LAMP Server

Building a LAMP Server

by Bruce Timberlake

This document will walk you through the installation of what is known as a "LAMP" system: Linux, Apache, MySQL and PHP. Depending on who you talk to, the P also stands for Perl or Python, but in general, it is assumed to be PHP. I run CentOS on my servers; these directions were written for CentOS/Red Hat/Fedora. I have had requests for SuSE (another RPM-based distribution) as well as Debian-based systems, so I will work on variants of these directions for those distributions in the future (donations might help speed that process up!). The main difference between the distributions is in the paths to the startup scripts. Red Hat systems used /etc/rc.d/init.d and SuSE uses /etc/init.d.

I have my first translation! Belorussian provided by Patricia -- thank you very much!

If you need an SSL-enabled server, I have a LAMP with SSL howto as well.

I designed this document so you can just copy/paste each line or block of commands into your shell session and it will "just work" for you. This avoids tedious typing, and the inevitable typos or missed steps that result. These commands work properly via copy/paste. If you are having problems and you are not using copy/paste, please re-check your typing before sending me an email saying "It doesn't work."

Text in a "command" box like this one is a literal Linux commandline, and should be typed or pasted exactly as written.

One note: many many people have followed these directions as written, and have not had any problems.
If you are having a problem, chances are it's something you are doing (or not doing), something different
about your computer, etc.

It is probably NOT this procedure. :)

Initial Steps

PLEASE BE AWARE THAT A SOURCE-BASED INSTALLATION LIKE THIS ONE IS NOT NEEDED FOR A BASIC LAMP SERVER! You should only be doing a source-based installation if you need to alter settings in one or more components of the LAMP stack (e.g., you need a feature in PHP that isn't in the default RPM). If you are just getting started with LAMP, use the binaries provided by your distribution - it is much simpler, and a lot easier to upgrade later.

Most out-of-the-box Red Hat Linux installations will have one or more of the LAMP components installed via RPM files. I personally believe in installing things like this from source, so I get the most control over what's compiled in, what's left out, etc. But source code installs can wreak havoc if overlaid on top of RPM installs, as the two most likely won't share the same directories, etc.

If you have not yet installed your Linux OS, or just for future reference, do not choose to install Apache, PHP, or MySQL during the system installation. Then you can immediately proceed with the source-based install listed here.

Note: to install applications from source code, you will need a C++ compiler (gcc++) installed. This is generally taken care of, but I've had enough queries about it that I've added this note to avoid getting more! You can use your distribution's install CDs to get the proper version of the compiler. Or, if you are using an RPM based distro, you can use a site like http://www.rpmfind.net/ to locate the correct RPM version for your system. (You will obviously not be able to use/rebuild a source RPM to get the compiler installed, as you need the compiler to build the final binary RPM!) On a Fedora system, you can do this command:

su - root
yum install gcc gcc-c++

Log in as root

Because we will be installing software to directories that "regular" users don't have write access to, and also possibly uninstalling RPM versions of some applications, we'll log in as root. The only steps that need root access are the actual installation steps, but by doing the configure and make steps as root, the source code will also be inaccessible to "regular" users.

If you do not have direct access (via keyboard) to the server, PLEASE use Secure Shell (SSH) to access the server and not telnet!! Whenever you use telnet (or plain FTP for that matter), you are transmitting your username, password, and all session information in "plain text". This means that anyone who can access a machine someplace between your PC and your server can snoop your session and get your info. Use encryption wherever possible!

su - root

Remove RPM Versions of the Applications

Before we start with our source code install, we need to remove all the existing RPM files for these products. To find out what RPMs are already installed, use the RPM query command:

rpm -qa

in conjunction with grep to filter your results:

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

The 'httpd' search is in case you have Apache2 installed via RPM.

To remove the RPMs generated by these commands, do

rpm -e filename

for each RPM you found in the query. If you have any content in your MySQL database already, the RPM removal step should not delete the database files. When you reinstall MySQL, you should be able to move all those files to your new MySQL data directory and have access to them all again.

Get the Source Code for all Applications

We want to put all our source code someplace central, so it's not getting mixed up in someone's home directory, etc.

cd /usr/local/src

One way application source code is distributed is in what are known as "tarballs." The tar command is usually associated with making tape backups - tar stands for Tape ARchive. It's also a handy way to pack up multiple files for easy distribution. Use the man tar command to learn more about how to use this very flexible tool.

At the time of updating this, the current versions of all the components we'll use are:

MySQL - 4.1.22
Apache - 1.3.37
PHP - 4.4.6

Please note: these are the only versions of these that I have set up myself, and verified these steps against. If you use another version of any component, especially a newer version, this HOWTO may not be accurate, and I won't be able to provide free support under those circumstances. Paid support and assistance is always available however.

wget http://www.php.net/distributions/php-4.4.6.tar.gz
wget http://apache.oregonstate.edu/httpd/apache_1.3.37.tar.gz

There may be an Apache mirror closer to you - check their mirror page for other sources. Then insert the URL you get in place of the above for the wget command.

For MySQL, go to http://www.mysql.com/ and choose an appropriate mirror to get the newest MySQL version (v4.1.22).

Unpack the Source Code

tar zxf php-4.4.6.tar.gz
tar zxf apache_1.3.37.tar.gz
tar zxf mysql-4.1.22.tar.gz

This should leave you with the following directories:

/usr/local/src/php-4.4.6
/usr/local/src/apache_1.3.37
/usr/local/src/mysql-4.1.22

Build and Install MySQL

First, we create the group and user that "owns" MySQL. For security purposes, we don't want MySQL running as root on the system. To be able to easily identify MySQL processes in top or a ps list, we'll make a user and group named mysql:

groupadd mysql
useradd -g mysql -c "MySQL Server" mysql

If you get any messages about the group or user already existing, that's fine. The goal is just to make sure we have them on the system.

What the useradd command is doing is creating a user mysql in the group mysql with the "name" of MySQL Server. This way when it's showed in various user and process watching apps, you'll be able to tell what it is right away.

Now we'll change to the "working" directory where the source code is, change the file 'ownership' for the source tree (this prevents build issues in reported in some cases where the packager's username was included on the source and you aren't using the exact same name to compile with!) and start building.

The configure command has many options you can specify. I have listed some fairly common ones; if you'd like to see others, do:

./configure --help | less

to see them all. Read the documentation on the MySQL website for a more detailed explanation of each option.

cd /usr/local/src/mysql-4.1.22

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

18-Jul-2005: If you are installing MySQL 4.0.x on Fedora Core 4, there is a problem with LinuxThreads that prevents MySQL from compiling properly. Installing on Fedora Core 3 works fine though. Thanks to Kevin Spencer for bringing this to my attention. There is a workaround listed at http://bugs.mysql.com/bug.php?id=9497. Thanks to Collin Campbell for that link. Another solution can be found at http://bugs.mysql.com/bug.php?id=2173. Thanks to Kaloyan Raev for that one.

Now comes the long part, where the source code is actually compiled and then installed. Plan to get some coffee or take a break while this step runs. It could be 10-15 minutes or more, depending on your system's free memory, load average, etc.

make && make install

Configure MySQL

MySQL is "installed" but we have a few more steps until it's actually "done" and ready to start. First run the script which actually sets up MySQL's internal database (named, oddly enough, mysql).

./scripts/mysql_install_db

Then we want to set the proper ownership for the MySQL directories and data files, so that only MySQL (and root) can do anything with them.

chown -R root:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data

Copy the default configuration file for the expected size of the database (small, medium, large, huge)

cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf

If you get an error message about the data directory not existing, etc., something went wrong in the mysql_install_db step above. Go back and review that; make sure you didn't get some sort of error message when you ran it, etc.

Now we have to tell the system where to find some of the dynamic libraries that MySQL will need to run. We use dynamic libraries instead of static to keep the memory usage of the MySQL program itself to a minimum.

echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig

Now create a startup script, which enables MySQL auto-start each time your server is restarted.

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on

Then set up symlinks for all the MySQL binaries, so they can be run from anyplace without having to include/specify long paths, etc.

cd /usr/local/mysql/bin
for file in *; do ln -s /usr/local/mysql/bin/$file /usr/bin/$file; done

MySQL Security Issues

First, we will assume that only applications on the same server will be allowed to access the database (i.e., not a program running on a physically separate server). So we'll tell MySQL not to even listen on port 3306 for TCP connections like it does by default.

Edit /etc/my.cnf and uncomment the

skip-networking

line (delete the leading #).

For more security info, check out this MySQL security tutorial.

Start MySQL

First, test the linked copy of the startup script in the normal server runlevel start directory, to make sure the symlink was properly set up:

cd ~
/etc/rc.d/rc3.d/S90mysql start

If you ever want to manually start or stop the MySQL server, use these commands:

/etc/rc.d/init.d/mysql start
/etc/rc.d/init.d/mysql stop

Let's "test" the install to see what version of MySQL we're running now:

mysqladmin version

It should answer back with the version we've just installed...

Now we'll set a password for the MySQL root user (note that the MySQL root user is not the same as the system root user, and definitely should not have the same password as the system root user!).

mysqladmin -u root password new-password

(obviously, insert your own password in the above command instead of the "new-password" string!)

You're done! MySQL is now installed and running on your server. It is highly recommended that you read about MySQL security and lock down your server as much as possible. The MySQL site has info at http://www.mysql.com/doc/en/Privilege_system.html.

Test MySQL

To run a quick test, use the command line program mysql:

mysql -u root -p

and enter your new root user password when prompted. You will then see the MySQL prompt:

mysql>

First, while we're in here, we'll take care of another security issue and delete the sample database test and all default accounts except for the MySQL root user. Enter each of these lines at the mysql> prompt:

drop database test;
use mysql;
delete from db;
delete from user where not (host="localhost" and user="root");
flush privileges;

As another security measure, I like to change the MySQL administrator account name from root to something harder to guess. This will make it that much harder for someone who gains shell access to your server to take control of MySQL.

MAKE SURE YOU REMEMBER THIS NEW NAME, AND USE IT WHEREVER
YOU SEE "root" IN OTHER DIRECTIONS, WEBSITES, ETC.

ONCE YOU DO THIS STEP, THE USERNAME "root" WILL CEASE TO
EXIST IN YOUR MYSQL CONFIGURATION!

update user set user="sqladmin" where user="root";
flush privileges;

Now, on with the "standard" testing... First, create a new database:

create database foo;

You should see the result:

Query OK, 1 row affected (0.04 sec)

mysql>

Delete the database:

drop database foo;

You should see the result:

Query OK, 0 rows affected (0.06 sec)

mysql>

To exit from mysql enter \q:

\q

Build and Install Apache (with DSO support)

The advantage to building Apache with support for dynamically loaded modules is that in the future, you can add functionality to your webserver by just compiling and installing modules, and restarting the webserver. If the features were compiled into Apache, you would need to rebuild Apache from scratch every time you wanted to add or update a module (like PHP). Your Apache binary is also smaller, which means more efficient memory usage.

The downside to dynamic modules is a slight performance hit compared to having the modules compiled in.

cd /usr/local/src/apache_1.3.37

make clean

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

make && make install

Build and Install PHP

This section has only been tested with PHP v4.x. If you are trying to build PHP 5.x, I do not have experience with this yet, and do not provide free support for you to get it working. Please note that there are many options which can be selected when compiling PHP. Some will have library dependencies, meaning certain software may need to be already installed on your server before you start building PHP. You can use the command

./configure --help | less

once you change into the PHP source directory. This will show you a list of all possible configuration switches. For more information on what these switches are, please check the PHP website documentation.

cd /usr/local/src/php-4.4.6

./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

I like to keep my config files all together in /etc. I set up a symbolic link like this:

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

Then I can just open /etc/php.ini in my editor to make changes.

Recommended reading on securing your PHP installation is this article at SecurityFocus.com.

Edit the Apache Configuration File (httpd.conf)

I like to keep all my configuration files together in /etc, so I set up a symbolic link from the actual location to /etc:

ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf

Now open /etc/httpd.conf in your favorite text editor, and set all the basic Apache options in accordance with the official Apache instructions (beyond the scope of this HOWTO).

Also recommended is the article on securing Apache.

To ensure your PHP files are properly interpreted, and not just downloaded as text files, remove the # at the beginning of the lines which read:
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

If the AddType lines above don't exist, manually enter them (without the leading # of course) after the line

AddType application/x-tar .tgz

or anyplace within the section of httpd.conf.

If you wish to use other/additional extensions/filetypes for your PHP scripts instead of just .php, add them to the AddType directive:

AddType application/x-httpd-php .php .foo
AddType application/x-httpd-php-source .phps .phtmls

An example: if you wanted every single HTML page to be parsed and processed like a PHP script, just add .htm and .html:

AddType application/x-httpd-php .php .htm .html

There will be a bit of a performance loss if every single HTML page is being checked for PHP code even if it doesn't contain any. But if you want to use PHP but be "stealthy" about it, you can use this trick.

Add index.php to the list of valid Directory Index files so that your "default page" in a directory can be named index.php.


DirectoryIndex index.php index.htm index.html


You can add anything else you want here too. If you want foobar.baz to be a valid directory index page, just add the .baz filetype to the AddType line, and add foobar.baz to the DirectoryIndex line.

Start Apache

We want to set Apache up with a normal start/stop script in /etc/rc.d/init.d so it can be auto-started and controlled like other system daemons. Set up a symbolic link for the apachectl utility (installed automatically as part of Apache):

ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache

Then set up auto-start for runlevel 3 (where the server will go by default):

ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S90apache

Then start the daemon:

/etc/rc.d/init.d/apache start

You can check that it's running properly by doing:

ps -ef

and look for the httpd processes.

Thursday, July 1, 2010

Basic commands in linux

1)ls
2)cp
3)mv
4)ps
5)top
6)top
7)netstat
8)tar
9)pstree
10)iptables
11)lsof
12)kill
13)fuser
14)useradd
15)groupadd
16)usermod
17)dig
18)wget
19)nmap
20)host
21)nslookup
22)stat
23)chattr
24)lsattr
25)chmod
26)chown
27)xorgs
28)watch
29)mount
30)umount
31)traceroute
32)grep
33)awk
34)sed
35)head
36)tail
37)sort
38)uniq
39)cut
40)nmap
41)ip
42)ln
43)vi
44)more
45)rm