Question? Leave a message!

php web development ppt

dynamic web application development using php and mysql ppt and web database programming using php ppt
NicolusNorton Profile Pic
Published Date:08-07-2017
Website URL
Building Web Application Using PHP & Oracle Balaranjith Amit Surana Date: November 8, 2013 CO Performance(Mar’12) Topics • Introduction about PhP • Architecture of Oracle-PhP • Using PhP along with Oracle Database • Best practices (DRCP) • Introduction to Frameworks • Integration with Oracle EBS CO Performance(Mar’12) About PHP •PHP is a server-side scripting language designed for web development but also used as a general- purpose programming language •PHP is compatible with most of the databases including Oracle. •Any web based application can be easily developed in PHP CO Performance(Mar’12) Why PHP • PHP is freely accessible • It's quick to develop in PHP • Programmers of Java, PERL, BASIC, and other popular languages can find many parallels to ease transition to PHP • It runs on disparate operating systems • There are many support groups, forums, and teams supporting PHP CO Performance(Mar’12) Architecture PHP & Oracle CO Performance(Mar’12) OCI8 • These functions allow you to access Oracle Database 12c, 11g, 10g, 9i and 8i. • They support SQL and PL/SQL statements. • Basic features include transaction control, binding of PHP variables to Oracle placeholders, and support for large object (LOB) types and collections. • Oracle's scalability features such as Database Resident Connection Pooling (DRCP) and result caching are also supported. CO Performance(Mar’12) Connection with Oracle Database • To enable the oracle database for PHP, after installation of LAMP or WAMP one needs to make some changes. • Find the PHP configuration file php.ini and locate the below line in the file and uncomment it. ;extension=php_oci8.dll CO Performance(Mar’12) Connecting to Database • To access the oracle database, first connect the database. Database could reside on local or remote server. • Before starting the connection one would require the username, password and tnsnames for the database. Below is the code for how to connect to Oracle database. ?php c = oci_connect('un', 'pw', '//localhost/XE'); ? CO Performance(Mar’12) Retrieving and Modifying data in Oracle using PHP • SELECT ?php s = oci_parse(conn, 'select from employees'); oci_execute(s); while (row = oci_fetch_array(s)) foreach (row as item) print item; ? CO Performance(Mar’12) Retrieving and Modifying data in Oracle using PHP • INSERT • Below is example code for “INSERT” statement. We can also create dynamic insert query if values from the form are to be inserted. • ?php s = oci_parse(conn, 'insert into employees(id,firstname,lastname,dob) values (1,‘Amit’, ‘Surana’, ’15-JUL-1990’)'); oci_execute(s); ? CO Performance(Mar’12) Calling Oracle Stored Procedure ?php s = oci_parse(conn, "begin atulorc_tk_pkg.ATL_TK_GET_WEEKOFF(:bind0, TO_DATE(:bind1,'DD-Mon-YYYY'), TO_DATE(:bind2,'DD-Mon-YYYY'), :bind3); exception when others then :bind4:=sqlerrm; end;"); oci_bind_by_name(s, ":bind0", _GET'emp_weekoff_chg',32); oci_bind_by_name(s, ":bind1", _GET'weekoff_date',32); oci_bind_by_name(s, ":bind2", _GET'new_date',32); oci_bind_by_name(s, ":bind3", msg,1000); // 32 is the return length oci_bind_by_name(s, ":bind4", err,1000); oci_execute(s, OCI_DEFAULT); ? OCI_BIND_BY_NAME() - Binds a PHP variable to an Oracle placeholder CO Performance(Mar’12) SQL Statement Execution • Parse - oci_parse() Prepares a statement for execution • Bind - oci_bind_by_name() Optionally binds variables in WHERE clause or to PL/SQL arguments • Execute - oci_execute() The Database executes the statement and buffers the results • Fetch - oci_fetch_array() Optionally retrieves results from the database CO Performance(Mar’12) Performance Improvement – DRCP (Data Resident Connection Pooling) • DRCP pools a set of dedicated database server processes (known as pooled servers), which can be shared across multiple applications running on the same or several hosts. • A connection broker process manages the pooled servers at the database instance level. • A connection broker accepts incoming connection requests from PHP processes (e.g. web server processes handling PHP requests) and assigns each a free server in the pool. CO Performance(Mar’12) DRCP Architecture CO Performance(Mar’12) DRCP Configuration • The pool needs to be started before connection requests begin. The command below does this by bringing up the broker, which registers with the database listener: – SQL execute dbms_connection_pool.start_pool(); • Configuring PHP for DRCP  PHP must be built with the OCI8 1.3 or later extension. PHP 5.3 contains OCI8 1.4. For PHP 5.2 and older versions of PHP, download the latest release of OCI8 from PECL, extract it and use it to replace the existing ext/oci8 directory in PHP. oci8.connection_class = MYPHPAPP c = oci_pconnect('myuser', 'mypassword', 'myhost/sales:POOLED'); CO Performance(Mar’12) Introduction to Frameworks • A framework provides the much sought after robustness and strength to the website. • It helps the developers to fast track the entire development process and consequently they can meet the high-end demands from the client side easily. • There are number of reasons for the need of frameworks required for PHP. CO Performance(Mar’12) Advantages of Framework • Code and File Organization • Utilities and Libraries • The MVC Pattern • Security • Less Code & Faster Development • Performance Tools • Suitable for Teamwork CO Performance(Mar’12) Framework Examples • Yii Framework  Yii is one of the most popular and top Framework amongst all PHP Frameworks.  Yii has myriad of features such as MVC, DAO / Active Record , I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, open source, high performing, object oriented, database access object, easy form validation, default support for web services and many more. • CodeIgniter  Built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.  It is a framework requires nearly zero configurations.  It helps in eschewing complexity, and favoring simple CO solution. Performance(Mar’12) Integrating with Oracle EBS • Have you tried opening Oracle EBS from disparate devices like mobile or tablet? • Found difficulty?? • Is there any solution to this??? CO Performance(Mar’12) Solution • We can create our bespoke applications to obtain the required data from the database and display it in vanilla form or do the manipulation and calculations and show it to users. • We can also create forms in PHP which are easy to build, rich in user interface and easy to deploy. CO Performance(Mar’12)