Q&A with Juan Loaiza Stay Focused on the Five Steps ... - NoCOUG
Q&A with Juan Loaiza Stay Focused on the Five Steps ... - NoCOUG
Q&A with Juan Loaiza Stay Focused on the Five Steps ... - NoCOUG
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
to use column names as <strong>the</strong> array keys. Additi<strong>on</strong>ally, <strong>the</strong><br />
oci_fetch_all() functi<strong>on</strong> places all of <strong>the</strong> rows of a result set<br />
into an array. The opti<strong>on</strong>al arguments of skip and maxrows<br />
can be used to easily provide paging functi<strong>on</strong>ality to applicati<strong>on</strong>s.<br />
Compiling, Linking, and Executing<br />
Because PHP is an interpreted language, <strong>the</strong>re is no compiling<br />
required. Lack of compilati<strong>on</strong> however does not equate<br />
to a lack of speed. PHP is remarkably fast out of <strong>the</strong> box, but<br />
<strong>the</strong>re are a number of compilati<strong>on</strong> programs available that<br />
make it even faster, or allow it to run in a .Net envir<strong>on</strong>ment.<br />
Different elements of a program may be linked by <strong>the</strong><br />
use of include files. These included files may c<strong>on</strong>tain class objects<br />
or simply support<br />
“Executing a PHP<br />
web applicati<strong>on</strong> is<br />
simply a matter of<br />
entering its URL in a<br />
browser, and voila—<br />
‘Hello, World!’”<br />
The <strong>NoCOUG</strong> Journal<br />
ing code of ano<strong>the</strong>r type.<br />
The linking is performed<br />
up<strong>on</strong> executi<strong>on</strong> of <strong>the</strong><br />
program. Again, <strong>on</strong>e<br />
would instinctively assume<br />
that this runtime<br />
linking would lead to<br />
performance issues, but<br />
PHP c<strong>on</strong>tinues to impress.<br />
Executing a PHP<br />
web applicati<strong>on</strong> is sim<br />
ply a matter of entering its URL in a browser, and voila—<br />
“Hello, World!”<br />
Fur<strong>the</strong>r Reading<br />
• The Official PHP Site: www.php.net<br />
• Oracle and PHP: www.oracle.com/technologies/php/<br />
index.html<br />
• Oracle PHP Developer Center: www.oracle.com/<br />
technology/tech/php/index.html <br />
David Schleis has worked for <strong>the</strong> Wisc<strong>on</strong>sin State Laboratory of<br />
Hygiene for over 20 years. Now working exclusively <str<strong>on</strong>g>with</str<strong>on</strong>g> PHP<br />
and Oracle, he c<strong>on</strong>tinues to build <strong>the</strong> “ultimate” Laboratory<br />
Informati<strong>on</strong> Management System (LIMS) for <strong>the</strong> Occupati<strong>on</strong>al<br />
Health Lab. If you want to talk to Dave about PHP or anything<br />
else, you can email him at dave@mail.slh.wisc.edu.<br />
Copyright © 2007, Dave Schleis<br />
Endnote<br />
1 There are three functi<strong>on</strong>s provided to c<strong>on</strong>nect to <strong>the</strong> database, depending<br />
<strong>on</strong> whe<strong>the</strong>r <strong>the</strong> requirements call for a standard c<strong>on</strong>necti<strong>on</strong>, a persisted<br />
c<strong>on</strong>necti<strong>on</strong> to increase efficiency, or a new c<strong>on</strong>necti<strong>on</strong> to ensure<br />
transacti<strong>on</strong> aut<strong>on</strong>omy. Something to c<strong>on</strong>sider when c<strong>on</strong>templating <strong>the</strong><br />
use of persisted c<strong>on</strong>necti<strong>on</strong>s <strong>on</strong> a multiprocess web server is that c<strong>on</strong>necti<strong>on</strong>s<br />
cannot be shared am<strong>on</strong>g different processes. I have found that<br />
using persisted c<strong>on</strong>necti<strong>on</strong>s leads to a buildup of idle sessi<strong>on</strong>s, and attempting<br />
to clean up idle sessi<strong>on</strong>s in Oracle by setting RESOURCE_<br />
LIMIT=TRUE causes c<strong>on</strong>necti<strong>on</strong> errors in <strong>the</strong> PHP applicati<strong>on</strong>s. I have<br />
since switched to standard c<strong>on</strong>necti<strong>on</strong>s, and <strong>the</strong>re has been no noticeable<br />
increase in page load times.<br />
// standard c<strong>on</strong>necti<strong>on</strong><br />
$cnn = oci_c<strong>on</strong>nect ($User, $Pass, $Inst);<br />
// persisted c<strong>on</strong>necti<strong>on</strong><br />
$pcnn = oci_pc<strong>on</strong>nect ($User, $Pass, $Inst);<br />
// new c<strong>on</strong>necti<strong>on</strong><br />
$ncnn = oci_new_c<strong>on</strong>nect ($User, $Pass, $Inst);<br />
My problems were <str<strong>on</strong>g>with</str<strong>on</strong>g> IIS 5 and PHP 4; things may be different now,<br />
or perhaps I did not find <strong>the</strong> correct combinati<strong>on</strong> of settings. I have not<br />
revisited <strong>the</strong> issue, as scaling to very high volumes is not as yet a vital<br />
c<strong>on</strong>cern to my organizati<strong>on</strong>.<br />
1