Thursday, November 7, 2013

PHP setting for oracle 11g Express Edition Database

After installing Oracle Database 11g Express Edition , you must need to do some PHP setting to connect and used the oracle database.
You need to enable the oci8_11g package for that. For this you may open your php.ini configuration file and find the extension=php_oci8_11g.dll
You may find following block of code like this

extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll

You just need to remove semicolon (;) from the begining of the extension=php_oci8_11g.dll  statement. Then restart all services and check it in your phpinfo.


Now, You can connect the database the sample code is as follows.

<?php

// Create connection to Oracle
$conn = oci_connect("user1", "password",  'localhost');

if (!$conn)
{
   $m = oci_error();
   echo $m['message'], "\n";
   exit;
}
else
{
   print "Connected to Oracle!";
}

$Rs = oci_parse($conn, 'select * from emp_master');
oci_execute($Rs);
echo "<pre>\n";

while (($row = oci_fetch_assoc($Rs)))
{
   print_r($row) ;
}

// Close the Oracle connection
oci_close($conn);
?>

Friday, October 25, 2013

How to change Apache port

The default port of Apache & IIS is 80. If you need to change your apache port. You may need to do small changes in your Apache setting file.

Open your httpd.conf file
IF you have Xampp then below path help you to find conf file
D:\xampp\apache\conf

IF you have wamp then below path help you to find conf file
D:\wamp\bin\apache\Apache2.2.21

In the file, find the line Listen 80 and change the port as per your need.
It like this

#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80

Save the conf file and restart the server.

Saturday, July 13, 2013

Apache installation on ubuntu

How to install Apache on ubuntu
Please enter the following command into your terminal prompt.

sudo apt-get install apache2

Command for restart the Apache
sudo service apache2 restart
OR 
sudo /etc/init.d/apache2 restart

Command for start the Apache
sudo /etc/init.d/apache2 start

Command for stop the Apache
sudo /etc/init.d/apache2 stop


Installation of php on ubuntu

sudo apt-get install php5

-----------------------

mysql
----------------------


sudo service mysql start

Friday, July 12, 2013

Chief Ministers of Maharashtra

Yashwantrao Chavan
Marotrao Kannamwar
P. K. Sawant
Vasantrao Naik
Shankarrao Chavan
Vasantdada Patil
Sharad Pawar
Abdul RehmanAntulay
Babasaheb Bhosale
Shivajirao Nilangekar Patil
Shankarrao Chavan
Sudhakarrao Naik
Manohar Joshi
Narayan Rane
Vilasrao Deshmukh
Sushilkumar Shinde
Ashok Chavan
Prithviraj Chavan

Thursday, June 27, 2013

htmlentities & htmlspecialchars in php

htmlentities 

Convert all applicable characters to HTML entities

$str = "A 'quote' is <b>bold</b>";

Example
echo htmlentities($str);
// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;



htmlspecialchars 

Convert special characters to HTML entities

'&' (ampersand) becomes '&amp;' 
'<' (less than) becomes '&lt;' 

Example
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; //Outputs:  &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;

(Uniform Resource Locator ) urlencode & urldecode in php

urlencode & urldecode in php

urlencode  — This function returns the string output

URL is converted into a valid ASCII format.
URL Encoding space is replaced by %20

Example
urlencode('Hello milind') return output ==>> Hello%20milind 

another example
urlencode('http://www.mywebsite.com/index.php?name=milind chaudhari&id=25');

Output is http://www.mywebsite.com/index.php?name=milind%20chaudhari&id=25


urldecode  — This function returns the string output
Decodes URL-encoded string

Returns the decoded string.

Example
urldecode('http://www.mywebsite.com/index.php?name=milind%20chaudhari&id=25');

Output
http://www.mywebsite.com/index.php?name=milind chaudhari&id=25

Saturday, June 1, 2013

Create Cron job/Task scheduler on windows local machine

For developer , It is most important to run the specific program for specific time of interval on local machine (localhost).
It can be done with the help of task scheduler

For Task schedular Go to the Start >> All programs >> Accessories >> System Tools >> Task Scheduler

Then click on Create Task
Fill all the details, please add the .bat file and complete the process.
Please specify the commands in to your .bat file.

In that .Bat file

D:\xampp\php\php.exe -f "D:\xampp\htdocs\mysqlbackup.php"


In mysqlbackup.php

$dbhost = "localhost"; // usually localhost
$dbuser = "root";
$dbpass = "";
$dbname = "Db_name";

$backupfile = 'E:/'.$dbname . date("Y-m-d") . 'todayDb.sql';
 system("D:/xampp/mysql/bin/mysqldump.exe -h $dbhost -u $dbuser $dbname > $backupfile");


Thursday, May 30, 2013

How to run PHP program on command prompt

Most time we run the php program though the web browsers. But if we want to run the php program from command prompt then we know how to run on Windows and Linux machine.

On Windows machine

C:\>  D:\path\to\php.exe -f  "D:\path\to\www\myfile.php"

On Linux machine

php myfile.php


Sunday, May 19, 2013

Introduction to Codeigniter

Codeigniter is an application development framework developed in PHP 5 using object oriented programming. It is an open source framework. It build on MVC (Model-View-Controller) pattern. Developer can build an application/ website with minimal code. Developer need not written the code from scratch. Codeigniter is developed in  EllisLab , Inc. The latest Version is  2.1.3
The Minimal requirement are as follows.
PHP version 5.1.6
MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite


For More detail you can visit
http://ellislab.com/codeigniter/user-guide/index.html

For Download Codeigniter

http://ellislab.com/codeigniter