Confiuring php from source

There are few steps if you want to compile and configure php from the source code available on php.net website.
1. Download the source code from the site.
2. unzip it to a directory of your choice [for eg. /home/uttam/].
3. go to your shell prompt.
4. run configure with the extension needed to support in php.[for eg. ./configure --with-mysql]
- you may see this type of error while configuring your php.

configure: error: xml2-config not found. Please check your libxml2 installation.
- In this case install libxml2 by using sudo apt-get install libxml2 libxml2-dev



5. You will get a thank you message for using php.
5. run make
6. run make install using command sudo make install.here you will see the following info which tell you directory info of PHP .
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/

7. By default PHP command will be loaded at /usr/local/bin/php directory.you can use /usr/local/bin/php -m to know options and extention available to use with php.

8. Congratulation you have successfully installed PHP.

Traffic exchange script



I will send you on mail all PHP script for create Traffic exchange website.

You need webhost with php and mysql, and mail servis available. 

With Traffic exchange script you can earn money when someone buy credits for exchange traffic.

Example of site you can see on DEMO

If you wan to earn conis go to Earn Cons and click to Surf.

You can add your website (Menu -> Add site) and ather user will surf your website.

You can also find this offer on >> Fiverr<<

HOW TO INSTALL traffic exchange script?

1. upload all files to your domain.

2. setup a new mysql database however you want.

3. import file db.sql into your database using phpmyadmin.

4. open config.php and type in the new database settings that you setup.

5. open your browser and load up your domain

6. login to your site as  admin/password 

7. Change your admin information and continue to adjust site as you want..

If you need any additional help or assistance , contact us!

PHP control statement and logical operator example

This tutorial is not like other PHP tutorial. To understand this tutorial you need to have enough knowledge on PHP control structure such as if, else, if….else etc and PHP logical operators. It gives you some capability to solve complex problem. Real life problem is very complex. For example, if Rahim age is between fifteen and sixteen then we call Rahim is teenage boy. So guys let’s start to write the problem in PHP code.
<? Php
$ Up_years = 20;
$ Low_years = 15;
If ($ up_years <20&& $ low_years> 15)
echo “Rahim is teenage boy”;
?>

We now try to write the problem in another way, if Rahim age is not between fifteen and twenty and also is not between twenty and hundred then we call Rahim is a little boy.
<? Php
If (($ low_years< 15&& up_years >20) && ($ low_years> 20 && $ up_years <100))
echo “Rahim is a little boy”;
?>

If Rahim age is fifteen or twenty then our program print “Now you are teenage”. We can solve it using php logical or operator.
<? Php
If (($ low_years == 15) | | ($ up_years == 20))
echo "Now you are teenage";
?>
It is very enjoyable for us to solve this type of problem. My suggestion is trying to solve different type of problem using logic. I hope you will get better results in PHP programming than others.

Installing PHP 5.2.5

Steps to setting up PHP 5.2.5 :

1. Install PHP :

First, extract the PHP package to “C:\PHP\”(make a new
folder name it as “PHP” and extract files in this folder).
Then make a copy of the file “php.ini-recommended” in
PHP directory and rename it to “PHP.ini”. This is the PHP
configuration file and we'll take a look what's in it
later on.

2. Up graders :


Remove the Old PHP.INI File from Your Windows Directory
If you are upgrading to PHP 5 from an older version, go to

your windows directory, typically “c:\windows”, and
delete any php.ini file that you have previously placed
there.

3. Modifying PHP Configuration File (php.ini) :


Now, open “php.ini” in some text editor. I am using

EditPlus 2” you can choose editor of your choice and
make following changes:

Document Root :

Search for the line that reads “doc_root = ” and replace

it with doc_root = C:/Apache/htdocs” and then search
for “; cgi.force_redirect = 1” and replace it with
cgi.force_redirect = 0” (*document root path in php.ini
should be the same as document root path in httpd.conf
in apache server).

Short Open Tags :


Search for the line that read
short_open_tag = Off” and replace it with
short_open_tag = On” (* it helps to recognise tags like
as start tag for a PHP script).

Magic Quotes :


Similarly, replace “magic_quotes_gpc = Off” with

magic_quotes_gpc = On”(*this allows your input data
to have the backslash (“\”) prefix).

Register Global :


Verify that register_globals is set to Off
register_globals = Off” (*if it is set On, it will allow
to write insecure codes).

Modifying Apache Configuration:

Apache doesn't know that you just install PHP. We need
to tell Apache about PHP and where to find it:

1. Open the Apache configuration file in
C:\Apache\conf\httpd.conf” and add line
PHPIniDir "C:/PHP/" to the top of the file (*this line
indicates the location of php.ini).

2. Add the following lines to the end of the file:


ScriptAlias /php/ "C:/PHP/" (*this line adds script alias

for “cgi-bin”).

Action application/x-httpd-php "C:/PHP/php-cgi.exe"
(*this line tells the server to execute the PHP executable
each time it encounters a PHP script).

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

(*this line is added so that you can view your php file
source code in the browser window).

LoadModule php5_module "C:/PHP/php5apache2_2.dll"

(*this line tells Apache where to load the dll required to
execute PHP).

If you create a file index.php, and want Apache to load

it as the directory index page for your website, you will
have to add another line to the "httpd.conf" file. To do
this, look for the line in the file that begins with
"DirectoryIndex" and add "index.php" to the list of files
on that line. For example, if the line used to be:
DirectoryIndex index.html” change it to
DirectoryIndex index.php index.html”.

Now restart Apache for the changes to take effect
(Start >Programs >Apache HTTP Server 2.2.6 >

Control Apache Server >Restart) .

Open the folder “C:\Apache\htdocs” and delete all the
existing items from it.

To check if everything is okay create a new file, name

it as “test.php” and put it in document root directory
(C:Apache\htdocs). The content of this file

is “< *? phpphpinfo(); *?>” (remove * sign before ?
to get actual content of this file).

phpinfo() is the infamous PHP function which will spit
out all kinds of stuff about PHP and your server
configuration. Type “http://localhost/test.php” on your
browser's address bar and if everything works well you
should see something like this:














also visit:http://webdeeksha.blogspot.com/


Working with memcached

memcached is a general-purpose distributed memory caching system used to speed up dynamic database driven websites by caching data in RAM to reduce the number of times an external data source to be read.

Here is how memcached can be useful.The system uses a client server architecture. Server maintains associative array in key value pair. the clients populate this array and query it. Keys are up to 250 bytes long and values can be at most 1 MB size. by default server runs on 11211 port. A client should be installed in order to access memcached data. client can connect to multiple server by adding new server to it's pool. gettting data from memcached there are several methods to use memcached. yo can go to official site for more information on memcached.

Using memcached from a script. [I've used PHP in example.]

1. Memcached class should exist if memcached client is installed properly. Create an object of memcached.

                  $obj = new Memcached();
    if object created means memcached service is running. If not then you can start the service from command prompt.using command  svc -u path/to/memcached/ [eg:  /usr/local/memcache/bin/memcached ]

2. Add the server to the pool.
                $obj->addServers($servers); [$servers = array( '172.18.1.69', 11211) where 1st param. is IP of the server and second is port.]

3 Now you can use different methods to add/fetch memcached data. [example get($key),set($key,$value)]. for more information visit php.net site and search for memcached based function.


Checking memcache log.

1. Go to memcashed directory  /service/memcached

2.write the following command to get log
tail -f log/main/current | tai64nlocal


Using telnet to connect to memcache server.

1. telnet server_IP port [telnet 127.0.01 11214]

Once connected, you can check if memcache key is set, by typing  get memcache_key_name to get the memcached data for the key memcache_key_name and press enter. You can also set and delete key using set and delete.

Well that's all folks. We'll see membase in the next session.





PHPCamp 2008 learning

This was the first PHP camp happening in india pune.I have just returned after attending un-organizing India’s biggest php camp.I learned a lots.I shared my knowledge of PHP security there.Overall I enjoyed this camp organized @ persistent system, was attended by over seven hundred interested intellectuals. Nice event, nice ppl..

Actual I was in search of such kind of platform where we all can share our knowledge and our expertise.I think this type of camp should continue for the years ahead....
want to download my presentation on PHP security ?? click here