-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
86 lines (66 loc) · 4.93 KB
/
index.html
File metadata and controls
86 lines (66 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="sybase.php.howto : Page explaining simple steps to provide connectivity between PHP and Sybase or SQL Anywhere databases" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>sybase.php.howto</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<a id="forkme_banner" href="https://github.com/mcinp/sybase.php.howto">View on GitHub</a>
<h1 id="project_title">sybase.php.howto</h1>
<h2 id="project_tagline">Page explaining simple steps to provide connectivity between PHP and Sybase or SQL Anywhere databases</h2>
<section id="downloads">
<a class="zip_download_link" href="https://github.com/mcinp/sybase.php.howto/zipball/master">Download this project as a .zip file</a>
<a class="tar_download_link" href="https://github.com/mcinp/sybase.php.howto/tarball/master">Download this project as a tar.gz file</a>
</section>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<h3>
<a name="foreword" class="anchor" href="#foreword"><span class="octicon octicon-link"></span></a>Foreword</h3>
<p>I decided to write this howto, because it took me some time to configure php to work with Sybase trying many approaches from php documentation and tutorials on the web. . What I present here is just one way of doing things, there are alternatives to that, but IMHO it's the least troublesome way (no module compiling, no strange dependencies etc.). Note that as a result you will be using sqlanywhere module for PHP by SAP company that provides compiled modules for all PHP versions > 5.1. It's not the sybase_ct module present in PHP documentation, but it provides all functionalities for interacting with the database.</p>
<h3>
<a name="background" class="anchor" href="#background"><span class="octicon octicon-link"></span></a>Background</h3>
<p>This tutorial has following assumptions:</p>
<ol>
<li>There's a need to connect to Sybase/SQL Anywhere database version 9 or above.</li>
<li>The database is on a remote server.</li>
<li>The connection is made from a Linux server running Apache 2+ and PHP 5.1+ using mod_php.</li>
</ol><p>Following configuration was tested for RHEL Linux, but you should be able top use it on any Linux distribution. It should also be applicable to MacOS and Windows+Apache+PHP configuration.</p>
<h3>
<a name="the-steps" class="anchor" href="#the-steps"><span class="octicon octicon-link"></span></a>The Steps</h3>
<ol>
<li>Make sure you have Apache and PHP installed and configured properly.</li>
<li>Download the SQL Anywhere Database Client from <em>SQL Anywhere Database Client Download</em> page (<a href="http://www.sybase.com/detail?id=1087327">http://www.sybase.com/detail?id=1087327</a>) selecting your platform.</li>
<li>Unpack the archive</li>
<li>From the clientxxxx directory (where xxxx is client version number) run setup script.</li>
<li>You can leave all questions on their defaults (the client package will be installed in /opt/sqlanywhere12).</li>
<li>Add this line to your httpd configuration script (on RHEL/CentOS/Fedora this is <em>/etc/sysconfig/httpd</em>).
<code>source /opt/sqlanywhere12/bin32/sa_config.sh</code>
It will provide proper paths to SQLAnywhere libraries.</li>
<li>Download appropriate compiled php module for your plaftorm and PHP version from <em>The SAP Sybase SQL Anywhere PHP Module</em> page (<a href="http://scn.sap.com/docs/DOC-40537">http://scn.sap.com/docs/DOC-40537</a>).</li>
<li>Copy the module to php modules directory (on RHEL/CentOS/Fedora this it's <em>/usr/lib/php/modules</em>, check phpinfo() output or php.ini script to see where your modules are stored.</li>
<li>Add configuration entry to load the module (on RHEL/CentOS/Fedora run <code>echo "extension=php-5.x.x_sqlanywhere_r.so" > /etc/php.d/sqlanywhere.ini</code>)</li>
<li>Restart httpd service.</li>
</ol><p>You should now be able to see the <strong>sqlanywhere</strong> section in your phpinfo() output.</p>
<h3>
<a name="further-reading" class="anchor" href="#further-reading"><span class="octicon octicon-link"></span></a>Further reading</h3>
<p>For code examples and API reference check <a href="http://dcx.sybase.com/index.html#1201/en/dbprogramming/php-support.html">http://dcx.sybase.com/index.html#1201/en/dbprogramming/php-support.html</a></p>
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">sybase.php.howto maintained by <a href="https://github.com/mcinp">mcinp</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
</body>
</html>