add globals controls to the fax menu item on the tab layout
[openemr.git] / phpmyadmin / doc / html / setup.html
blob06027623a342e43aad79df0d784495d60afbe0b7
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9 <title>Installation &mdash; phpMyAdmin 4.5.4.1 documentation</title>
11 <link rel="stylesheet" href="_static/default.css" type="text/css" />
12 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
14 <script type="text/javascript">
15 var DOCUMENTATION_OPTIONS = {
16 URL_ROOT: './',
17 VERSION: '4.5.4.1',
18 COLLAPSE_INDEX: false,
19 FILE_SUFFIX: '.html',
20 HAS_SOURCE: true
22 </script>
23 <script type="text/javascript" src="_static/jquery.js"></script>
24 <script type="text/javascript" src="_static/underscore.js"></script>
25 <script type="text/javascript" src="_static/doctools.js"></script>
26 <link rel="copyright" title="Copyright" href="copyright.html" />
27 <link rel="top" title="phpMyAdmin 4.5.4.1 documentation" href="index.html" />
28 <link rel="next" title="Configuration" href="config.html" />
29 <link rel="prev" title="Requirements" href="require.html" />
30 </head>
31 <body>
32 <div class="related">
33 <h3>Navigation</h3>
34 <ul>
35 <li class="right" style="margin-right: 10px">
36 <a href="genindex.html" title="General Index"
37 accesskey="I">index</a></li>
38 <li class="right" >
39 <a href="config.html" title="Configuration"
40 accesskey="N">next</a> |</li>
41 <li class="right" >
42 <a href="require.html" title="Requirements"
43 accesskey="P">previous</a> |</li>
44 <li><a href="index.html">phpMyAdmin 4.5.4.1 documentation</a> &raquo;</li>
45 </ul>
46 </div>
48 <div class="document">
49 <div class="documentwrapper">
50 <div class="bodywrapper">
51 <div class="body">
53 <div class="section" id="installation">
54 <span id="setup"></span><h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
55 <p>phpMyAdmin does not apply any special security methods to the MySQL
56 database server. It is still the system administrator&#8217;s job to grant
57 permissions on the MySQL databases properly. phpMyAdmin&#8217;s <em class="guilabel">Users</em>
58 page can be used for this.</p>
59 <div class="admonition warning">
60 <p class="first admonition-title">Warning</p>
61 <p class="last"><a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a> users should note that if you are on a version before
62 <a class="reference internal" href="glossary.html#term-mac-os-x"><em class="xref std std-term">Mac OS X</em></a>, StuffIt unstuffs with <a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a> formats. So you&#8217;ll have
63 to resave as in BBEdit to Unix style ALL phpMyAdmin scripts before
64 uploading them to your server, as PHP seems not to like <a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a>-style
65 end of lines character (&#8220;<tt class="docutils literal"><span class="pre">\r</span></tt>&#8221;).</p>
66 </div>
67 <div class="section" id="linux-distributions">
68 <h2>Linux distributions<a class="headerlink" href="#linux-distributions" title="Permalink to this headline"></a></h2>
69 <p>phpMyAdmin is included in most Linux distributions. It is recommended to use
70 distribution packages when possible - they usually provide integration to your
71 distribution and you will automatically get security updates from your distribution.</p>
72 <div class="section" id="debian">
73 <h3>Debian<a class="headerlink" href="#debian" title="Permalink to this headline"></a></h3>
74 <p>Debian&#8217;s package repositories include a phpMyAdmin package, but be aware that
75 the configuration file is maintained in <tt class="docutils literal"><span class="pre">/etc/phpmyadmin</span></tt> and may differ in
76 some ways from the official phpMyAdmin documentation.</p>
77 </div>
78 <div class="section" id="opensuse">
79 <h3>OpenSUSE<a class="headerlink" href="#opensuse" title="Permalink to this headline"></a></h3>
80 <p>OpenSUSE already comes with phpMyAdmin package, just install packages from
81 the <a class="reference external" href="http://software.opensuse.org/package/phpMyAdmin">openSUSE Build Service</a>.</p>
82 </div>
83 <div class="section" id="ubuntu">
84 <h3>Ubuntu<a class="headerlink" href="#ubuntu" title="Permalink to this headline"></a></h3>
85 <p>Ubuntu ships phpMyAdmin package, however if you want to use recent version, you
86 can use packages from
87 <a class="reference external" href="https://launchpad.net/~nijel/+archive/phpmyadmin">PPA for Michal Čihař</a>.</p>
88 </div>
89 <div class="section" id="gentoo">
90 <h3>Gentoo<a class="headerlink" href="#gentoo" title="Permalink to this headline"></a></h3>
91 <p>Gentoo ships the phpMyAdmin package, both in a near stock configuration as well
92 as in a <tt class="docutils literal"><span class="pre">webapp-config</span></tt> configuration. Use <tt class="docutils literal"><span class="pre">emerge</span> <span class="pre">dev-db/phpmyadmin</span></tt> to
93 install.</p>
94 </div>
95 <div class="section" id="mandriva">
96 <h3>Mandriva<a class="headerlink" href="#mandriva" title="Permalink to this headline"></a></h3>
97 <p>Mandriva ships the phpMyAdmin package in their <tt class="docutils literal"><span class="pre">contrib</span></tt> branch and can be
98 installed via the usual Control Center.</p>
99 </div>
100 <div class="section" id="fedora">
101 <h3>Fedora<a class="headerlink" href="#fedora" title="Permalink to this headline"></a></h3>
102 <p>Fedora ships the phpMyAdmin package, but be aware that the configuration file
103 is maintained in <tt class="docutils literal"><span class="pre">/etc/phpMyAdmin/</span></tt> and may differ in some ways from the
104 official phpMyAdmin documentation.</p>
105 </div>
106 <div class="section" id="red-hat-enterprise-linux">
107 <h3>Red Hat Enterprise Linux<a class="headerlink" href="#red-hat-enterprise-linux" title="Permalink to this headline"></a></h3>
108 <p>Red Hat Enterprise Linux itself and thus derivatives like CentOS don&#8217;t
109 ship phpMyAdmin, but the Fedora-driven repository
110 <a class="reference external" href="http://fedoraproject.org/wiki/EPEL">Extra Packages for Enterprise Linux (EPEL)</a>
111 is doing so, if it&#8217;s
112 <a class="reference external" href="http://fedoraproject.org/wiki/EPEL/FAQ#howtouse">enabled</a>.
113 But be aware that the configuration file is maintained in
114 <tt class="docutils literal"><span class="pre">/etc/phpMyAdmin/</span></tt> and may differ in some ways from the
115 official phpMyAdmin documentation.</p>
116 </div>
117 </div>
118 <div class="section" id="installing-on-windows">
119 <h2>Installing on Windows<a class="headerlink" href="#installing-on-windows" title="Permalink to this headline"></a></h2>
120 <p>The easiest way to get phpMyAdmin on Windows is using third party products
121 which include phpMyAdmin together with a database and web server such as
122 <a class="reference external" href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>.</p>
123 <p>You can find more of such options at <a class="reference external" href="https://en.wikipedia.org/wiki/List_of_AMP_packages">Wikipedia</a>.</p>
124 </div>
125 <div class="section" id="quick-install">
126 <span id="id1"></span><h2>Quick Install<a class="headerlink" href="#quick-install" title="Permalink to this headline"></a></h2>
127 <ol class="arabic simple">
128 <li>Choose an appropriate distribution kit from the phpmyadmin.net
129 Downloads page. Some kits contain only the English messages, others
130 contain all languages. We&#8217;ll assume you chose a kit whose name
131 looks like <tt class="docutils literal"><span class="pre">phpMyAdmin-x.x.x</span> <span class="pre">-all-languages.tar.gz</span></tt>.</li>
132 <li>Ensure you have downloaded a genuine archive, see <a class="reference internal" href="#verify"><em>Verifying phpMyAdmin releases</em></a>.</li>
133 <li>Untar or unzip the distribution (be sure to unzip the subdirectories):
134 <tt class="docutils literal"><span class="pre">tar</span> <span class="pre">-xzvf</span> <span class="pre">phpMyAdmin_x.x.x-all-languages.tar.gz</span></tt> in your
135 webserver&#8217;s document root. If you don&#8217;t have direct access to your
136 document root, put the files in a directory on your local machine,
137 and, after step 4, transfer the directory on your web server using,
138 for example, ftp.</li>
139 <li>Ensure that all the scripts have the appropriate owner (if PHP is
140 running in safe mode, having some scripts with an owner different from
141 the owner of other scripts will be a problem). See <a class="reference internal" href="faq.html#faq4-2"><em>4.2 What&#8217;s the preferred way of making phpMyAdmin secure against evil access?</em></a> and
142 <a class="reference internal" href="faq.html#faq1-26"><em>1.26 I just installed phpMyAdmin in my document root of IIS but I get the error &#8220;No input file specified&#8221; when trying to run phpMyAdmin.</em></a> for suggestions.</li>
143 <li>Now you must configure your installation. There are two methods that
144 can be used. Traditionally, users have hand-edited a copy of
145 <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>, but now a wizard-style setup script is provided
146 for those who prefer a graphical installation. Creating a
147 <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> is still a quick way to get started and needed for
148 some advanced features.</li>
149 </ol>
150 <div class="section" id="manually-creating-the-file">
151 <h3>Manually creating the file<a class="headerlink" href="#manually-creating-the-file" title="Permalink to this headline"></a></h3>
152 <p>To manually create the file, simply use your text editor to create the
153 file <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> (you can copy <tt class="file docutils literal"><span class="pre">config.sample.inc.php</span></tt> to get
154 a minimal configuration file) in the main (top-level) phpMyAdmin
155 directory (the one that contains <tt class="file docutils literal"><span class="pre">index.php</span></tt>). phpMyAdmin first
156 loads <tt class="file docutils literal"><span class="pre">libraries/config.default.php</span></tt> and then overrides those values
157 with anything found in <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>. If the default value is
158 okay for a particular setting, there is no need to include it in
159 <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>. You&#8217;ll probably need only a few directives to get going; a
160 simple configuration may look like this:</p>
161 <div class="highlight-xml+php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
162 <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;blowfish_secret&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;ba17c1ec07d65003&#39;</span><span class="p">;</span> <span class="c1">// use here a value of your choice</span>
164 <span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
165 <span class="nv">$i</span><span class="o">++</span><span class="p">;</span>
166 <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;cookie&#39;</span><span class="p">;</span>
167 <span class="cp">?&gt;</span>
168 </pre></div>
169 </div>
170 <p>Or, if you prefer to not be prompted every time you log in:</p>
171 <div class="highlight-xml+php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
173 <span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
174 <span class="nv">$i</span><span class="o">++</span><span class="p">;</span>
175 <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;user&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;root&#39;</span><span class="p">;</span>
176 <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;password&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;cbb74bc&#39;</span><span class="p">;</span> <span class="c1">// use here your password</span>
177 <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;config&#39;</span><span class="p">;</span>
178 <span class="cp">?&gt;</span>
179 </pre></div>
180 </div>
181 <p>For a full explanation of possible configuration values, see the
182 <a class="reference internal" href="config.html#config"><em>Configuration</em></a> of this document.</p>
183 </div>
184 <div class="section" id="using-setup-script">
185 <span id="setup-script"></span><span id="index-0"></span><h3>Using Setup script<a class="headerlink" href="#using-setup-script" title="Permalink to this headline"></a></h3>
186 <p>Instead of manually editing <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>, you can use phpMyAdmin&#8217;s
187 setup feature. First you must manually create a folder <tt class="docutils literal"><span class="pre">config</span></tt>
188 in the phpMyAdmin directory. This is a security measure. On a
189 Linux/Unix system you can use the following commands:</p>
190 <div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>phpMyAdmin
191 mkdir config <span class="c"># create directory for saving</span>
192 chmod o+rw config <span class="c"># give it world writable permissions</span>
193 </pre></div>
194 </div>
195 <p>And to edit an existing configuration, copy it over first:</p>
196 <div class="highlight-sh"><div class="highlight"><pre>cp config.inc.php config/ <span class="c"># copy current configuration for editing</span>
197 chmod o+w config/config.inc.php <span class="c"># give it world writable permissions</span>
198 </pre></div>
199 </div>
200 <div class="admonition note">
201 <p class="first admonition-title">Note</p>
202 <p class="last">Debian and Ubuntu have simplified this setup and all you need to do is to
203 execute <strong class="program">/usr/sbin/pma-configure</strong>.</p>
204 </div>
205 <p>On other platforms, simply create the folder and ensure that your web
206 server has read and write access to it. <a class="reference internal" href="faq.html#faq1-26"><em>1.26 I just installed phpMyAdmin in my document root of IIS but I get the error &#8220;No input file specified&#8221; when trying to run phpMyAdmin.</em></a> can help with
207 this.</p>
208 <p>Next, open your browser and visit the location where you installed phpMyAdmin, with the <tt class="docutils literal"><span class="pre">/setup</span></tt> suffix. If you have an existing configuration,
209 use the <tt class="docutils literal"><span class="pre">Load</span></tt> button to bring its content inside the setup panel.
210 Note that <strong>changes are not saved to disk until you explicitly choose ``Save``</strong>
211 from the <em>Configuration</em> area of the screen. Normally the script saves the new
212 <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> to the <tt class="docutils literal"><span class="pre">config/</span></tt> directory, but if the webserver does
213 not have the proper permissions you may see the error &#8220;Cannot load or
214 save configuration.&#8221; Ensure that the <tt class="docutils literal"><span class="pre">config/</span></tt> directory exists and
215 has the proper permissions - or use the <tt class="docutils literal"><span class="pre">Download</span></tt> link to save the
216 config file locally and upload it (via FTP or some similar means) to the
217 proper location.</p>
218 <p>Once the file has been saved, it must be moved out of the <tt class="docutils literal"><span class="pre">config/</span></tt>
219 directory and the permissions must be reset, again as a security
220 measure:</p>
221 <div class="highlight-sh"><div class="highlight"><pre>mv config/config.inc.php . <span class="c"># move file to current directory</span>
222 chmod o-rw config.inc.php <span class="c"># remove world read and write permissions</span>
223 rm -rf config <span class="c"># remove not needed directory</span>
224 </pre></div>
225 </div>
226 <div class="admonition note">
227 <p class="first admonition-title">Note</p>
228 <p class="last">Debian and Ubuntu have simplified this setup and all you need to do is to
229 execute <strong class="program">/usr/sbin/pma-secure</strong>.</p>
230 </div>
231 <p>Now the file is ready to be used. You can choose to review or edit the
232 file with your favorite editor, if you prefer to set some advanced
233 options which the setup script does not provide.</p>
234 <ol class="arabic simple">
235 <li>If you are using the <tt class="docutils literal"><span class="pre">auth_type</span></tt> &#8220;config&#8221;, it is suggested that you
236 protect the phpMyAdmin installation directory because using config
237 does not require a user to enter a password to access the phpMyAdmin
238 installation. Use of an alternate authentication method is
239 recommended, for example with HTTP–AUTH in a <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file or switch to using
240 <tt class="docutils literal"><span class="pre">auth_type</span></tt> cookie or http. See the <a class="reference internal" href="faq.html#faqmultiuser"><em>ISPs, multi-user installations</em></a>
241 for additional information, especially <a class="reference internal" href="faq.html#faq4-4"><em>4.4 phpMyAdmin always gives &#8220;Access denied&#8221; when using HTTP authentication.</em></a>.</li>
242 <li>Open the <a class="reference external" href="index.php">main phpMyAdmin directory</a> in your browser.
243 phpMyAdmin should now display a welcome screen and your databases, or
244 a login dialog if using <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> or
245 cookie authentication mode.</li>
246 <li>You should deny access to the <tt class="docutils literal"><span class="pre">./libraries</span></tt> and <tt class="docutils literal"><span class="pre">./setup/lib</span></tt>
247 subfolders in your webserver configuration.
248 Such configuration prevents from possible
249 path exposure and cross side scripting vulnerabilities that might
250 happen to be found in that code. For the Apache webserver, this is
251 often accomplished with a <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file in those directories.</li>
252 <li>It is generally a good idea to protect a public phpMyAdmin installation
253 against access by robots as they usually can not do anything good
254 there. You can do this using <tt class="docutils literal"><span class="pre">robots.txt</span></tt> file in root of your
255 webserver or limit access by web server configuration, see
256 <a class="reference internal" href="faq.html#faq1-42"><em>1.42 How can I prevent robots from accessing phpMyAdmin?</em></a>.</li>
257 </ol>
258 </div>
259 </div>
260 <div class="section" id="verifying-phpmyadmin-releases">
261 <span id="verify"></span><h2>Verifying phpMyAdmin releases<a class="headerlink" href="#verifying-phpmyadmin-releases" title="Permalink to this headline"></a></h2>
262 <p>Since July 2015 all phpMyAdmin releases are cryptographically signed by the
263 releasing developer, who is currently Marc Delisle. His key id is
264 0x81AF644A, his PGP fingerprint is:</p>
265 <div class="highlight-console"><div class="highlight"><pre><span class="go">436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A</span>
266 </pre></div>
267 </div>
268 <p>and you can get more identification information from <a class="reference external" href="https://keybase.io/lem9">https://keybase.io/lem9</a>. You should verify that the signature matches
269 the archive you have downloaded. This way you can be sure that you are using
270 the same code that was released.</p>
271 <p>Each archive is accompanied with <tt class="docutils literal"><span class="pre">.asc</span></tt> files which contains the PGP signature
272 for it. Once you have both of them in the same folder, you can verify the signature:</p>
273 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --verify phpMyAdmin-4.4.9-all-languages.zip.asc
274 <span class="go">gpg: Signature made Fri Jun 12 13:09:58 2015 CEST using RSA key ID 81AF644A</span>
275 <span class="go">gpg: Can&#39;t check signature: No public key</span>
276 </pre></div>
277 </div>
278 <p>As you can see gpg complains that it does not know the public key. At this
279 point you should do one of the following steps:</p>
280 <ul class="simple">
281 <li>Download the keyring from <a class="reference external" href="https://files.phpmyadmin.net/phpmyadmin.keyring">our download server</a>, then import it with:</li>
282 </ul>
283 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --import phpmyadmin.keyring
284 </pre></div>
285 </div>
286 <ul class="simple">
287 <li>Download and import the key from one of the key servers:</li>
288 </ul>
289 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --keyserver hkp://pgp.mit.edu --recv-keys 81AF644A
290 <span class="go">gpg: requesting key 81AF644A from hkp server pgp.mit.edu</span>
291 <span class="go">gpg: key 81AF644A: public key &quot;Marc Delisle &lt;marc@infomarc.info&gt;&quot; imported</span>
292 <span class="go">gpg: no ultimately trusted keys found</span>
293 <span class="go">gpg: Total number processed: 1</span>
294 <span class="go">gpg: imported: 1 (RSA: 1)</span>
295 </pre></div>
296 </div>
297 <p>This will improve the situation a bit - at this point you can verify that the
298 signature from the given key is correct but you still can not trust the name used
299 in the key:</p>
300 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --verify phpMyAdmin-4.4.9-all-languages.zip.asc
301 <span class="go">gpg: Signature made Fri Jun 12 13:09:58 2015 CEST using RSA key ID 81AF644A</span>
302 <span class="go">gpg: Good signature from &quot;Marc Delisle &lt;marc@infomarc.info&gt;&quot; [unknown]</span>
303 <span class="go">gpg: WARNING: This key is not certified with a trusted signature!</span>
304 <span class="go">gpg: There is no indication that the signature belongs to the owner.</span>
305 <span class="go">Primary key fingerprint: 436F F188 4B1A 0C3F DCBF 0D79 FEFC 65D1 81AF 644A</span>
306 </pre></div>
307 </div>
308 <p>The problem here is that anybody could issue the key with this name. You need to
309 ensure that the key is actually owned by the mentioned person. The GNU Privacy
310 Handbook covers this topic in the chapter <a class="reference external" href="https://www.gnupg.org/gph/en/manual.html#AEN335">Validating other keys on your public
311 keyring</a>. The most reliable method is to meet the developer in person and
312 exchange key fingerprints, however you can also rely on the web of trust. This way
313 you can trust the key transitively though signatures of others, who have met
314 the developer in person. For example you can see how <a class="reference external" href="http://pgp.cs.uu.nl/mk_path.cgi?FROM=00411886&amp;TO=81AF644A">Marc&#8217;s key links to
315 Linus&#8217;s key</a>.</p>
316 <p>Once the key is trusted, the warning will not occur:</p>
317 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --verify phpMyAdmin-4.4.9-all-languages.zip.asc
318 <span class="go">gpg: Signature made Fri Jun 12 13:09:58 2015 CEST using RSA key ID 81AF644A</span>
319 <span class="go">gpg: Good signature from &quot;Marc Delisle &lt;marc@infomarc.info&gt;&quot; [full]</span>
320 </pre></div>
321 </div>
322 <p>Should the signature be invalid (the archive has been changed), you would get a
323 clear error regardless of the fact that the key is trusted or not:</p>
324 <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> gpg --verify phpMyAdmin-4.4.9-all-languages.zip.asc
325 <span class="go">gpg: Signature made Fri Jun 12 13:09:58 2015 CEST using RSA key ID 81AF644A</span>
326 <span class="go">gpg: BAD signature from &quot;Marc Delisle &lt;marc@infomarc.info&gt;&quot; [unknown]</span>
327 </pre></div>
328 </div>
329 </div>
330 <div class="section" id="phpmyadmin-configuration-storage">
331 <span id="linked-tables"></span><span id="index-1"></span><h2>phpMyAdmin configuration storage<a class="headerlink" href="#phpmyadmin-configuration-storage" title="Permalink to this headline"></a></h2>
332 <p>For a whole set of additional features (bookmarks, comments, <a class="reference internal" href="glossary.html#term-sql"><em class="xref std std-term">SQL</em></a>-history,
333 tracking mechanism, <a class="reference internal" href="glossary.html#term-pdf"><em class="xref std std-term">PDF</em></a>-generation, column contents transformation,
334 etc.) you need to create a set of special tables. Those tables can be located
335 in your own database, or in a central database for a multi-user installation
336 (this database would then be accessed by the controluser, so no other user
337 should have rights to it).</p>
338 <div class="section" id="zero-configuration">
339 <h3>Zero configuration<a class="headerlink" href="#zero-configuration" title="Permalink to this headline"></a></h3>
340 <p>In many cases, this database structure can be automatically created and
341 configured. This is called “Zero Configuration” mode and can be particularly
342 useful in shared hosting situations. “Zeroconf” mode is on by default, to
343 disable set <span class="target" id="index-2"></span><a class="reference internal" href="config.html#cfg_ZeroConf"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['ZeroConf']</span></tt></a> to false.</p>
344 <p>The following three scenarios are covered by the Zero Configuration mode:</p>
345 <ul class="simple">
346 <li>When entering a database where the configuration storage tables are not
347 present, phpMyAdmin offers to create them from the Operations tab.</li>
348 <li>When entering a database where the tables do already exist, the software
349 automatically detects this and begins using them. This is the most common
350 situation; after the tables are initially created automatically they are
351 continually used without disturbing the user; this is also most useful on
352 shared hosting where the user is not able to edit <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> and
353 usually the user only has access to one database.</li>
354 <li>When having access to multiple databases, if the user first enters the
355 database containing the configuration storage tables then switches to
356 another database,
357 phpMyAdmin continues to use the tables from the first database; the user is
358 not prompted to create more tables in the new database.</li>
359 </ul>
360 </div>
361 <div class="section" id="manual-configuration">
362 <h3>Manual configuration<a class="headerlink" href="#manual-configuration" title="Permalink to this headline"></a></h3>
363 <p>Please look at your <tt class="docutils literal"><span class="pre">./sql/</span></tt> directory, where you should find a
364 file called <em>create_tables.sql</em>. (If you are using a Windows server,
365 pay special attention to <a class="reference internal" href="faq.html#faq1-23"><em>1.23 I&#8217;m running MySQL on a Win32 machine. Each time I create a new table the table and column names are changed to lowercase!</em></a>).</p>
366 <p>If you already had this infrastructure and:</p>
367 <ul class="simple">
368 <li>upgraded to MySQL 4.1.2 or newer, please use
369 <tt class="file docutils literal"><span class="pre">sql/upgrade_tables_mysql_4_1_2+.sql</span></tt>.</li>
370 <li>upgraded to phpMyAdmin 4.3.0 or newer from 2.5.0 or newer (&lt;= 4.2.x),
371 please use <tt class="file docutils literal"><span class="pre">sql/upgrade_column_info_4_3_0+.sql</span></tt>.</li>
372 </ul>
373 <p>and then create new tables by importing <tt class="file docutils literal"><span class="pre">sql/create_tables.sql</span></tt>.</p>
374 <p>You can use your phpMyAdmin to create the tables for you. Please be
375 aware that you may need special (administrator) privileges to create
376 the database and tables, and that the script may need some tuning,
377 depending on the database name.</p>
378 <p>After having imported the <tt class="file docutils literal"><span class="pre">sql/create_tables.sql</span></tt> file, you
379 should specify the table names in your <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> file. The
380 directives used for that can be found in the <a class="reference internal" href="config.html#config"><em>Configuration</em></a>.</p>
381 <p>You will also need to have a controluser
382 (<span class="target" id="index-3"></span><a class="reference internal" href="config.html#cfg_Servers_controluser"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controluser']</span></tt></a> and
383 <span class="target" id="index-4"></span><a class="reference internal" href="config.html#cfg_Servers_controlpass"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controlpass']</span></tt></a> settings)
384 with the proper rights to those tables. For example you can create it
385 using following statement:</p>
386 <div class="highlight-mysql"><div class="highlight"><pre><span class="k">GRANT</span> <span class="k">SELECT</span><span class="p">,</span> <span class="k">INSERT</span><span class="p">,</span> <span class="k">UPDATE</span><span class="p">,</span> <span class="k">DELETE</span> <span class="k">ON</span> <span class="o">&lt;</span><span class="n">pma_db</span><span class="o">&gt;</span><span class="p">.</span><span class="o">*</span> <span class="k">TO</span> <span class="s1">&#39;pma&#39;</span><span class="o">@</span><span class="s1">&#39;localhost&#39;</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;pmapass&#39;</span><span class="p">;</span>
387 </pre></div>
388 </div>
389 </div>
390 </div>
391 <div class="section" id="upgrading-from-an-older-version">
392 <span id="upgrading"></span><h2>Upgrading from an older version<a class="headerlink" href="#upgrading-from-an-older-version" title="Permalink to this headline"></a></h2>
393 <p><strong>Never</strong> extract the new version over an existing installation
394 of phpMyAdmin; we had evidence of problems caused by this.</p>
395 <p>Simply copy <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> from your previous installation into
396 the newly unpacked one. Configuration files from old versions may
397 require some tweaking as some options have been changed or removed.
398 For compatibility with PHP 5.3 and later, remove a
399 <tt class="docutils literal"><span class="pre">set_magic_quotes_runtime(0);</span></tt> statement that you might find near
400 the end of your configuration file.</p>
401 <p>You should <strong>not</strong> copy <tt class="file docutils literal"><span class="pre">libraries/config.default.php</span></tt> over
402 <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> because the default configuration file is version-
403 specific.</p>
404 <p>If you have upgraded your MySQL server from a version previous to 4.1.2 to
405 version 5.x or newer and if you use the phpMyAdmin configuration storage, you
406 should run the <a class="reference internal" href="glossary.html#term-sql"><em class="xref std std-term">SQL</em></a> script found in
407 <tt class="file docutils literal"><span class="pre">sql/upgrade_tables_mysql_4_1_2+.sql</span></tt>.</p>
408 <p>If you have upgraded your phpMyAdmin to 4.3.0 or newer from 2.5.0 or
409 newer (&lt;= 4.2.x) and if you use the phpMyAdmin configuration storage, you
410 should run the <a class="reference internal" href="glossary.html#term-sql"><em class="xref std std-term">SQL</em></a> script found in
411 <tt class="file docutils literal"><span class="pre">sql/upgrade_column_info_4_3_0+.sql</span></tt>.</p>
412 <p>Do not forget to clear the browser cache and to empty the old session by
413 logging out and logging in again.</p>
414 </div>
415 <div class="section" id="using-authentication-modes">
416 <span id="authentication-modes"></span><span id="index-5"></span><h2>Using authentication modes<a class="headerlink" href="#using-authentication-modes" title="Permalink to this headline"></a></h2>
417 <p><a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> and cookie authentication modes are recommended in a <strong>multi-user
418 environment</strong> where you want to give users access to their own database and
419 don&#8217;t want them to play around with others. Nevertheless be aware that MS
420 Internet Explorer seems to be really buggy about cookies, at least till version
421 6. Even in a <strong>single-user environment</strong>, you might prefer to use <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a>
422 or cookie mode so that your user/password pair are not in clear in the
423 configuration file.</p>
424 <p><a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> and cookie authentication
425 modes are more secure: the MySQL login information does not need to be
426 set in the phpMyAdmin configuration file (except possibly for the
427 <span class="target" id="index-6"></span><a class="reference internal" href="config.html#cfg_Servers_controluser"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controluser']</span></tt></a>).
428 However, keep in mind that the password travels in plain text, unless
429 you are using the HTTPS protocol. In cookie mode, the password is
430 stored, encrypted with the AES algorithm, in a temporary cookie.</p>
431 <p>Then each of the <em>true</em> users should be granted a set of privileges
432 on a set of particular databases. Normally you shouldn&#8217;t give global
433 privileges to an ordinary user, unless you understand the impact of those
434 privileges (for example, you are creating a superuser).
435 For example, to grant the user <em>real_user</em> with all privileges on
436 the database <em>user_base</em>:</p>
437 <div class="highlight-mysql"><div class="highlight"><pre><span class="k">GRANT</span> <span class="k">ALL</span> <span class="n">PRIVILEGES</span> <span class="k">ON</span> <span class="n">user_base</span><span class="p">.</span><span class="o">*</span> <span class="k">TO</span> <span class="s1">&#39;real_user&#39;</span><span class="o">@</span><span class="n">localhost</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;real_password&#39;</span><span class="p">;</span>
438 </pre></div>
439 </div>
440 <p>What the user may now do is controlled entirely by the MySQL user management
441 system. With HTTP or cookie authentication mode, you don&#8217;t need to fill the
442 user/password fields inside the <span class="target" id="index-7"></span><a class="reference internal" href="config.html#cfg_Servers"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers']</span></tt></a>.</p>
443 <div class="section" id="http-authentication-mode">
444 <span id="index-8"></span><h3>HTTP authentication mode<a class="headerlink" href="#http-authentication-mode" title="Permalink to this headline"></a></h3>
445 <ul class="simple">
446 <li>Uses <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> Basic authentication
447 method and allows you to log in as any valid MySQL user.</li>
448 <li>Is supported with most PHP configurations. For <a class="reference internal" href="glossary.html#term-iis"><em class="xref std std-term">IIS</em></a> (<a class="reference internal" href="glossary.html#term-isapi"><em class="xref std std-term">ISAPI</em></a>)
449 support using <a class="reference internal" href="glossary.html#term-cgi"><em class="xref std std-term">CGI</em></a> PHP see <a class="reference internal" href="faq.html#faq1-32"><em>1.32 Can I use HTTP authentication with IIS?</em></a>, for using with Apache
450 <a class="reference internal" href="glossary.html#term-cgi"><em class="xref std std-term">CGI</em></a> see <a class="reference internal" href="faq.html#faq1-35"><em>1.35 Can I use HTTP authentication with Apache CGI?</em></a>.</li>
451 <li>See also <a class="reference internal" href="faq.html#faq4-4"><em>4.4 phpMyAdmin always gives &#8220;Access denied&#8221; when using HTTP authentication.</em></a> about not using the <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> mechanism along with
452 &#8216;<a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a>&#8216; authentication mode.</li>
453 </ul>
454 </div>
455 <div class="section" id="cookie-authentication-mode">
456 <span id="cookie"></span><span id="index-9"></span><h3>Cookie authentication mode<a class="headerlink" href="#cookie-authentication-mode" title="Permalink to this headline"></a></h3>
457 <ul class="simple">
458 <li>Username and password are stored in cookies during the session and password
459 is deleted when it ends.</li>
460 <li>With this mode, the user can truly log out of phpMyAdmin and log
461 back in with the same username.</li>
462 <li>If you want to allow users to enter any hostname to connect (rather than only
463 servers that are configured in <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>),
464 see the <span class="target" id="index-10"></span><a class="reference internal" href="config.html#cfg_AllowArbitraryServer"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['AllowArbitraryServer']</span></tt></a> directive.</li>
465 <li>As mentioned in the <a class="reference internal" href="require.html#require"><em>Requirements</em></a> section, having the <tt class="docutils literal"><span class="pre">mcrypt</span></tt> extension will
466 speed up access considerably, but is not required.</li>
467 </ul>
468 </div>
469 <div class="section" id="signon-authentication-mode">
470 <span id="auth-signon"></span><span id="index-11"></span><h3>Signon authentication mode<a class="headerlink" href="#signon-authentication-mode" title="Permalink to this headline"></a></h3>
471 <ul class="simple">
472 <li>This mode is a convenient way of using credentials from another
473 application to authenticate to phpMyAdmin to implement single signon
474 solution.</li>
475 <li>The other application has to store login information into session
476 data (see <span class="target" id="index-12"></span><a class="reference internal" href="config.html#cfg_Servers_SignonSession"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonSession']</span></tt></a>) or you
477 need to implement script to return the credentials (see
478 <span class="target" id="index-13"></span><a class="reference internal" href="config.html#cfg_Servers_SignonScript"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonScript']</span></tt></a>).</li>
479 <li>When no credentials are available, the user is being redirected to
480 <span class="target" id="index-14"></span><a class="reference internal" href="config.html#cfg_Servers_SignonURL"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonURL']</span></tt></a>, where you should handle
481 the login process.</li>
482 </ul>
483 <p>The very basic example of saving credentials in a session is available as
484 <tt class="file docutils literal"><span class="pre">examples/signon.php</span></tt>:</p>
485 <div class="highlight-php"><div class="highlight"><pre><span class="o">&lt;?</span><span class="nx">php</span>
486 <span class="cm">/* vim: set expandtab sw=4 ts=4 sts=4: */</span>
487 <span class="sd">/**</span>
488 <span class="sd"> * Single signon for phpMyAdmin</span>
489 <span class="sd"> *</span>
490 <span class="sd"> * This is just example how to use session based single signon with</span>
491 <span class="sd"> * phpMyAdmin, it is not intended to be perfect code and look, only</span>
492 <span class="sd"> * shows how you can integrate this functionality in your application.</span>
493 <span class="sd"> *</span>
494 <span class="sd"> * @package PhpMyAdmin</span>
495 <span class="sd"> * @subpackage Example</span>
496 <span class="sd"> */</span>
498 <span class="cm">/* Need to have cookie visible from parent directory */</span>
499 <span class="nb">session_set_cookie_params</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span>
500 <span class="cm">/* Create signon session */</span>
501 <span class="nv">$session_name</span> <span class="o">=</span> <span class="s1">&#39;SignonSession&#39;</span><span class="p">;</span>
502 <span class="nb">session_name</span><span class="p">(</span><span class="nv">$session_name</span><span class="p">);</span>
503 <span class="c1">// Uncomment and change the following line to match your $cfg[&#39;SessionSavePath&#39;]</span>
504 <span class="c1">//session_save_path(&#39;/foobar&#39;);</span>
505 <span class="nb">session_start</span><span class="p">();</span>
507 <span class="cm">/* Was data posted? */</span>
508 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;user&#39;</span><span class="p">]))</span> <span class="p">{</span>
509 <span class="cm">/* Store there credentials */</span>
510 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_user&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;user&#39;</span><span class="p">];</span>
511 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_password&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;password&#39;</span><span class="p">];</span>
512 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_host&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;host&#39;</span><span class="p">];</span>
513 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_port&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;port&#39;</span><span class="p">];</span>
514 <span class="cm">/* Update another field of server configuration */</span>
515 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_cfgupdate&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;verbose&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Signon test&#39;</span><span class="p">);</span>
516 <span class="nv">$id</span> <span class="o">=</span> <span class="nb">session_id</span><span class="p">();</span>
517 <span class="cm">/* Close that session */</span>
518 <span class="nb">session_write_close</span><span class="p">();</span>
519 <span class="cm">/* Redirect to phpMyAdmin (should use absolute URL here!) */</span>
520 <span class="nb">header</span><span class="p">(</span><span class="s1">&#39;Location: ../index.php&#39;</span><span class="p">);</span>
521 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
522 <span class="cm">/* Show simple form */</span>
523 <span class="nb">header</span><span class="p">(</span><span class="s1">&#39;Content-Type: text/html; charset=utf-8&#39;</span><span class="p">);</span>
524 <span class="k">echo</span> <span class="s1">&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&#39;</span> <span class="o">.</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
525 <span class="cp">?&gt;</span><span class="x"></span>
526 <span class="x"> &lt;!DOCTYPE HTML&gt;</span>
527 <span class="x"> &lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;</span>
528 <span class="x"> &lt;head&gt;</span>
529 <span class="x"> &lt;link rel=&quot;icon&quot; href=&quot;../favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;</span>
530 <span class="x"> &lt;link rel=&quot;shortcut icon&quot; href=&quot;../favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;</span>
531 <span class="x"> &lt;meta charset=&quot;utf-8&quot; /&gt;</span>
532 <span class="x"> &lt;title&gt;phpMyAdmin single signon example&lt;/title&gt;</span>
533 <span class="x"> &lt;/head&gt;</span>
534 <span class="x"> &lt;body&gt;</span>
535 <span class="x"> </span><span class="cp">&lt;?php</span>
536 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_error_message&#39;</span><span class="p">]))</span> <span class="p">{</span>
537 <span class="k">echo</span> <span class="s1">&#39;&lt;p class=&quot;error&quot;&gt;&#39;</span><span class="p">;</span>
538 <span class="k">echo</span> <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_error_message&#39;</span><span class="p">];</span>
539 <span class="k">echo</span> <span class="s1">&#39;&lt;/p&gt;&#39;</span><span class="p">;</span>
540 <span class="p">}</span>
541 <span class="cp">?&gt;</span><span class="x"></span>
542 <span class="x"> &lt;form action=&quot;signon.php&quot; method=&quot;post&quot;&gt;</span>
543 <span class="x"> Username: &lt;input type=&quot;text&quot; name=&quot;user&quot; /&gt;&lt;br /&gt;</span>
544 <span class="x"> Password: &lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt;&lt;br /&gt;</span>
545 <span class="x"> Host: (will use the one from config.inc.php by default)</span>
546 <span class="x"> &lt;input type=&quot;text&quot; name=&quot;host&quot; /&gt;&lt;br /&gt;</span>
547 <span class="x"> Port: (will use the one from config.inc.php by default)</span>
548 <span class="x"> &lt;input type=&quot;text&quot; name=&quot;port&quot; /&gt;&lt;br /&gt;</span>
549 <span class="x"> &lt;input type=&quot;submit&quot; /&gt;</span>
550 <span class="x"> &lt;/form&gt;</span>
551 <span class="x"> &lt;/body&gt;</span>
552 <span class="x"> &lt;/html&gt;</span>
553 <span class="x"> </span><span class="cp">&lt;?php</span>
554 <span class="p">}</span>
555 <span class="cp">?&gt;</span><span class="x"></span>
556 </pre></div>
557 </div>
558 <p>Alternatively you can also use this way to integrate with OpenID as shown
559 in <tt class="file docutils literal"><span class="pre">examples/openid.php</span></tt>:</p>
560 <div class="highlight-php"><div class="highlight"><pre><span class="o">&lt;?</span><span class="nx">php</span>
561 <span class="cm">/* vim: set expandtab sw=4 ts=4 sts=4: */</span>
562 <span class="sd">/**</span>
563 <span class="sd"> * Single signon for phpMyAdmin using OpenID</span>
564 <span class="sd"> *</span>
565 <span class="sd"> * This is just example how to use single signon with phpMyAdmin, it is</span>
566 <span class="sd"> * not intended to be perfect code and look, only shows how you can</span>
567 <span class="sd"> * integrate this functionality in your application.</span>
568 <span class="sd"> *</span>
569 <span class="sd"> * It uses OpenID pear package, see http://pear.php.net/package/OpenID</span>
570 <span class="sd"> *</span>
571 <span class="sd"> * User first authenticates using OpenID and based on content of $AUTH_MAP</span>
572 <span class="sd"> * the login information is passed to phpMyAdmin in session data.</span>
573 <span class="sd"> *</span>
574 <span class="sd"> * @package PhpMyAdmin</span>
575 <span class="sd"> * @subpackage Example</span>
576 <span class="sd"> */</span>
578 <span class="k">if</span> <span class="p">(</span><span class="k">false</span> <span class="o">===</span> <span class="o">@</span><span class="k">include_once</span> <span class="s1">&#39;OpenID/RelyingParty.php&#39;</span><span class="p">)</span> <span class="p">{</span>
579 <span class="k">exit</span><span class="p">;</span>
580 <span class="p">}</span>
582 <span class="sd">/**</span>
583 <span class="sd"> * Map of authenticated users to MySQL user/password pairs.</span>
584 <span class="sd"> */</span>
585 <span class="nv">$AUTH_MAP</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
586 <span class="s1">&#39;http://launchpad.net/~username&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span>
587 <span class="s1">&#39;user&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;root&#39;</span><span class="p">,</span>
588 <span class="s1">&#39;password&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;&#39;</span><span class="p">,</span>
589 <span class="p">),</span>
590 <span class="p">);</span>
592 <span class="sd">/**</span>
593 <span class="sd"> * Simple function to show HTML page with given content.</span>
594 <span class="sd"> *</span>
595 <span class="sd"> * @param string $contents Content to include in page</span>
596 <span class="sd"> *</span>
597 <span class="sd"> * @return void</span>
598 <span class="sd"> */</span>
599 <span class="k">function</span> <span class="nf">Show_page</span><span class="p">(</span><span class="nv">$contents</span><span class="p">)</span>
600 <span class="p">{</span>
601 <span class="nb">header</span><span class="p">(</span><span class="s1">&#39;Content-Type: text/html; charset=utf-8&#39;</span><span class="p">);</span>
602 <span class="k">echo</span> <span class="s1">&#39;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&#39;</span> <span class="o">.</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
603 <span class="cp">?&gt;</span><span class="x"></span>
604 <span class="x"> &lt;!DOCTYPE HTML&gt;</span>
605 <span class="x"> &lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;</span>
606 <span class="x"> &lt;head&gt;</span>
607 <span class="x"> &lt;link rel=&quot;icon&quot; href=&quot;../favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;</span>
608 <span class="x"> &lt;link rel=&quot;shortcut icon&quot; href=&quot;../favicon.ico&quot; type=&quot;image/x-icon&quot; /&gt;</span>
609 <span class="x"> &lt;meta charset=&quot;utf-8&quot; /&gt;</span>
610 <span class="x"> &lt;title&gt;phpMyAdmin OpenID signon example&lt;/title&gt;</span>
611 <span class="x"> &lt;/head&gt;</span>
612 <span class="x"> &lt;body&gt;</span>
613 <span class="x"> </span><span class="cp">&lt;?php</span>
614 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nb">isset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_error_message&#39;</span><span class="p">]))</span> <span class="p">{</span>
615 <span class="k">echo</span> <span class="s1">&#39;&lt;p class=&quot;error&quot;&gt;&#39;</span> <span class="o">.</span> <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_message&#39;</span><span class="p">]</span> <span class="o">.</span> <span class="s1">&#39;&lt;/p&gt;&#39;</span><span class="p">;</span>
616 <span class="nb">unset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_message&#39;</span><span class="p">]);</span>
617 <span class="p">}</span>
618 <span class="k">echo</span> <span class="nv">$contents</span><span class="p">;</span>
619 <span class="cp">?&gt;</span><span class="x"></span>
620 <span class="x"> &lt;/body&gt;</span>
621 <span class="x"> &lt;/html&gt;</span>
622 <span class="x"> </span><span class="cp">&lt;?php</span>
623 <span class="p">}</span>
625 <span class="cm">/* Need to have cookie visible from parent directory */</span>
626 <span class="nb">session_set_cookie_params</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span>
627 <span class="cm">/* Create signon session */</span>
628 <span class="nv">$session_name</span> <span class="o">=</span> <span class="s1">&#39;SignonSession&#39;</span><span class="p">;</span>
629 <span class="nb">session_name</span><span class="p">(</span><span class="nv">$session_name</span><span class="p">);</span>
630 <span class="nb">session_start</span><span class="p">();</span>
632 <span class="c1">// Determine realm and return_to</span>
633 <span class="nv">$base</span> <span class="o">=</span> <span class="s1">&#39;http&#39;</span><span class="p">;</span>
634 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;HTTPS&#39;</span><span class="p">])</span> <span class="o">&amp;&amp;</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;HTTPS&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;on&#39;</span><span class="p">)</span> <span class="p">{</span>
635 <span class="nv">$base</span> <span class="o">.=</span> <span class="s1">&#39;s&#39;</span><span class="p">;</span>
636 <span class="p">}</span>
637 <span class="nv">$base</span> <span class="o">.=</span> <span class="s1">&#39;://&#39;</span> <span class="o">.</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;SERVER_NAME&#39;</span><span class="p">]</span> <span class="o">.</span> <span class="s1">&#39;:&#39;</span> <span class="o">.</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;SERVER_PORT&#39;</span><span class="p">];</span>
639 <span class="nv">$realm</span> <span class="o">=</span> <span class="nv">$base</span> <span class="o">.</span> <span class="s1">&#39;/&#39;</span><span class="p">;</span>
640 <span class="nv">$returnTo</span> <span class="o">=</span> <span class="nv">$base</span> <span class="o">.</span> <span class="nb">dirname</span><span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;PHP_SELF&#39;</span><span class="p">]);</span>
641 <span class="k">if</span> <span class="p">(</span><span class="nv">$returnTo</span><span class="p">[</span><span class="cm">/*overload*/</span><span class="nb">mb_strlen</span><span class="p">(</span><span class="nv">$returnTo</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s1">&#39;/&#39;</span><span class="p">)</span> <span class="p">{</span>
642 <span class="nv">$returnTo</span> <span class="o">.=</span> <span class="s1">&#39;/&#39;</span><span class="p">;</span>
643 <span class="p">}</span>
644 <span class="nv">$returnTo</span> <span class="o">.=</span> <span class="s1">&#39;openid.php&#39;</span><span class="p">;</span>
646 <span class="cm">/* Display form */</span>
647 <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">count</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nb">count</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">)</span> <span class="o">||</span> <span class="nb">isset</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;phpMyAdmin&#39;</span><span class="p">]))</span> <span class="p">{</span>
648 <span class="cm">/* Show simple form */</span>
649 <span class="nv">$content</span> <span class="o">=</span> <span class="s1">&#39;&lt;form action=&quot;openid.php&quot; method=&quot;post&quot;&gt;</span>
650 <span class="s1">OpenID: &lt;input type=&quot;text&quot; name=&quot;identifier&quot; /&gt;&lt;br /&gt;</span>
651 <span class="s1">&lt;input type=&quot;submit&quot; name=&quot;start&quot; /&gt;</span>
652 <span class="s1">&lt;/form&gt;</span>
653 <span class="s1">&lt;/body&gt;</span>
654 <span class="s1">&lt;/html&gt;&#39;</span><span class="p">;</span>
655 <span class="nx">Show_page</span><span class="p">(</span><span class="nv">$content</span><span class="p">);</span>
656 <span class="k">exit</span><span class="p">;</span>
657 <span class="p">}</span>
659 <span class="cm">/* Grab identifier */</span>
660 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;identifier&#39;</span><span class="p">]))</span> <span class="p">{</span>
661 <span class="nv">$identifier</span> <span class="o">=</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;identifier&#39;</span><span class="p">];</span>
662 <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;identifier&#39;</span><span class="p">]))</span> <span class="p">{</span>
663 <span class="nv">$identifier</span> <span class="o">=</span> <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;identifier&#39;</span><span class="p">];</span>
664 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
665 <span class="nv">$identifier</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
666 <span class="p">}</span>
668 <span class="cm">/* Create OpenID object */</span>
669 <span class="k">try</span> <span class="p">{</span>
670 <span class="nv">$o</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">OpenID_RelyingParty</span><span class="p">(</span><span class="nv">$returnTo</span><span class="p">,</span> <span class="nv">$realm</span><span class="p">,</span> <span class="nv">$identifier</span><span class="p">);</span>
671 <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">OpenID_Exception</span> <span class="nv">$e</span><span class="p">)</span> <span class="p">{</span>
672 <span class="nv">$contents</span> <span class="o">=</span> <span class="s2">&quot;&lt;div class=&#39;relyingparty_results&#39;&gt;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
673 <span class="nv">$contents</span> <span class="o">.=</span> <span class="s2">&quot;&lt;pre&gt;&quot;</span> <span class="o">.</span> <span class="nv">$e</span><span class="o">-&gt;</span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="s2">&quot;&lt;/pre&gt;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
674 <span class="nv">$contents</span> <span class="o">.=</span> <span class="s2">&quot;&lt;/div class=&#39;relyingparty_results&#39;&gt;&quot;</span><span class="p">;</span>
675 <span class="nx">Show_page</span><span class="p">(</span><span class="nv">$contents</span><span class="p">);</span>
676 <span class="k">exit</span><span class="p">;</span>
677 <span class="p">}</span>
679 <span class="cm">/* Redirect to OpenID provider */</span>
680 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;start&#39;</span><span class="p">]))</span> <span class="p">{</span>
681 <span class="k">try</span> <span class="p">{</span>
682 <span class="nv">$authRequest</span> <span class="o">=</span> <span class="nv">$o</span><span class="o">-&gt;</span><span class="na">prepare</span><span class="p">();</span>
683 <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">OpenID_Exception</span> <span class="nv">$e</span><span class="p">)</span> <span class="p">{</span>
684 <span class="nv">$contents</span> <span class="o">=</span> <span class="s2">&quot;&lt;div class=&#39;relyingparty_results&#39;&gt;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
685 <span class="nv">$contents</span> <span class="o">.=</span> <span class="s2">&quot;&lt;pre&gt;&quot;</span> <span class="o">.</span> <span class="nv">$e</span><span class="o">-&gt;</span><span class="na">getMessage</span><span class="p">()</span> <span class="o">.</span> <span class="s2">&quot;&lt;/pre&gt;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
686 <span class="nv">$contents</span> <span class="o">.=</span> <span class="s2">&quot;&lt;/div class=&#39;relyingparty_results&#39;&gt;&quot;</span><span class="p">;</span>
687 <span class="nx">Show_page</span><span class="p">(</span><span class="nv">$contents</span><span class="p">);</span>
688 <span class="k">exit</span><span class="p">;</span>
689 <span class="p">}</span>
691 <span class="nv">$url</span> <span class="o">=</span> <span class="nv">$authRequest</span><span class="o">-&gt;</span><span class="na">getAuthorizeURL</span><span class="p">();</span>
693 <span class="nb">header</span><span class="p">(</span><span class="s2">&quot;Location: </span><span class="si">$url</span><span class="s2">&quot;</span><span class="p">);</span>
694 <span class="k">exit</span><span class="p">;</span>
695 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
696 <span class="cm">/* Grab query string */</span>
697 <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">count</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">))</span> <span class="p">{</span>
698 <span class="k">list</span><span class="p">(,</span> <span class="nv">$queryString</span><span class="p">)</span> <span class="o">=</span> <span class="nb">explode</span><span class="p">(</span><span class="s1">&#39;?&#39;</span><span class="p">,</span> <span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;REQUEST_URI&#39;</span><span class="p">]);</span>
699 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
700 <span class="c1">// I hate php sometimes</span>
701 <span class="nv">$queryString</span> <span class="o">=</span> <span class="nb">file_get_contents</span><span class="p">(</span><span class="s1">&#39;php://input&#39;</span><span class="p">);</span>
702 <span class="p">}</span>
704 <span class="cm">/* Check reply */</span>
705 <span class="nv">$message</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">OpenID_Message</span><span class="p">(</span><span class="nv">$queryString</span><span class="p">,</span> <span class="nx">OpenID_Message</span><span class="o">::</span><span class="na">FORMAT_HTTP</span><span class="p">);</span>
707 <span class="nv">$id</span> <span class="o">=</span> <span class="nv">$message</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;openid.claimed_id&#39;</span><span class="p">);</span>
709 <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">empty</span><span class="p">(</span><span class="nv">$id</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nb">isset</span><span class="p">(</span><span class="nv">$AUTH_MAP</span><span class="p">[</span><span class="nv">$id</span><span class="p">]))</span> <span class="p">{</span>
710 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_user&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$AUTH_MAP</span><span class="p">[</span><span class="nv">$id</span><span class="p">][</span><span class="s1">&#39;user&#39;</span><span class="p">];</span>
711 <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">&#39;PMA_single_signon_password&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$AUTH_MAP</span><span class="p">[</span><span class="nv">$id</span><span class="p">][</span><span class="s1">&#39;password&#39;</span><span class="p">];</span>
712 <span class="nb">session_write_close</span><span class="p">();</span>
713 <span class="cm">/* Redirect to phpMyAdmin (should use absolute URL here!) */</span>
714 <span class="nb">header</span><span class="p">(</span><span class="s1">&#39;Location: ../index.php&#39;</span><span class="p">);</span>
715 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
716 <span class="nx">Show_page</span><span class="p">(</span><span class="s1">&#39;&lt;p&gt;User not allowed!&lt;/p&gt;&#39;</span><span class="p">);</span>
717 <span class="k">exit</span><span class="p">;</span>
718 <span class="p">}</span>
719 <span class="p">}</span>
720 </pre></div>
721 </div>
722 <p>If you intend to pass the credentials using some other means than, you have to
723 implement wrapper in PHP to get that data and set it to
724 <span class="target" id="index-15"></span><a class="reference internal" href="config.html#cfg_Servers_SignonScript"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonScript']</span></tt></a>. There is very minimal example
725 in <tt class="file docutils literal"><span class="pre">examples/signon-script.php</span></tt>:</p>
726 <div class="highlight-php"><div class="highlight"><pre><span class="o">&lt;?</span><span class="nx">php</span>
727 <span class="cm">/* vim: set expandtab sw=4 ts=4 sts=4: */</span>
728 <span class="sd">/**</span>
729 <span class="sd"> * Single signon for phpMyAdmin</span>
730 <span class="sd"> *</span>
731 <span class="sd"> * This is just example how to use script based single signon with</span>
732 <span class="sd"> * phpMyAdmin, it is not intended to be perfect code and look, only</span>
733 <span class="sd"> * shows how you can integrate this functionality in your application.</span>
734 <span class="sd"> *</span>
735 <span class="sd"> * @package PhpMyAdmin</span>
736 <span class="sd"> * @subpackage Example</span>
737 <span class="sd"> */</span>
740 <span class="sd">/**</span>
741 <span class="sd"> * This function returns username and password.</span>
742 <span class="sd"> *</span>
743 <span class="sd"> * It can optionally use configured username as parameter.</span>
744 <span class="sd"> *</span>
745 <span class="sd"> * @param string $user User name</span>
746 <span class="sd"> *</span>
747 <span class="sd"> * @return array</span>
748 <span class="sd"> */</span>
749 <span class="k">function</span> <span class="nf">get_login_credentials</span><span class="p">(</span><span class="nv">$user</span><span class="p">)</span>
750 <span class="p">{</span>
751 <span class="cm">/* Optionally we can use passed username */</span>
752 <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">empty</span><span class="p">(</span><span class="nv">$user</span><span class="p">))</span> <span class="p">{</span>
753 <span class="k">return</span> <span class="k">array</span><span class="p">(</span><span class="nv">$user</span><span class="p">,</span> <span class="s1">&#39;password&#39;</span><span class="p">);</span>
754 <span class="p">}</span>
756 <span class="cm">/* Here we would retrieve the credentials */</span>
757 <span class="nv">$credentials</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">);</span>
759 <span class="k">return</span> <span class="nv">$credentials</span><span class="p">;</span>
760 <span class="p">}</span>
761 </pre></div>
762 </div>
763 <div class="admonition seealso">
764 <p class="first admonition-title">See also</p>
765 <p class="last"><span class="target" id="index-16"></span><a class="reference internal" href="config.html#cfg_Servers_auth_type"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['auth_type']</span></tt></a>,
766 <span class="target" id="index-17"></span><a class="reference internal" href="config.html#cfg_Servers_SignonSession"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonSession']</span></tt></a>,
767 <span class="target" id="index-18"></span><a class="reference internal" href="config.html#cfg_Servers_SignonScript"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonScript']</span></tt></a>,
768 <span class="target" id="index-19"></span><a class="reference internal" href="config.html#cfg_Servers_SignonURL"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonURL']</span></tt></a></p>
769 </div>
770 </div>
771 <div class="section" id="config-authentication-mode">
772 <span id="index-20"></span><h3>Config authentication mode<a class="headerlink" href="#config-authentication-mode" title="Permalink to this headline"></a></h3>
773 <ul class="simple">
774 <li>This mode is sometimes the less secure one because it requires you to fill the
775 <span class="target" id="index-21"></span><a class="reference internal" href="config.html#cfg_Servers_user"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['user']</span></tt></a> and
776 <span class="target" id="index-22"></span><a class="reference internal" href="config.html#cfg_Servers_password"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['password']</span></tt></a>
777 fields (and as a result, anyone who can read your <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>
778 can discover your username and password).</li>
779 <li>In the <a class="reference internal" href="faq.html#faqmultiuser"><em>ISPs, multi-user installations</em></a> section, there is an entry explaining how
780 to protect your configuration file.</li>
781 <li>For additional security in this mode, you may wish to consider the
782 Host authentication <span class="target" id="index-23"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_order"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['order']</span></tt></a>
783 and <span class="target" id="index-24"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_rules"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['rules']</span></tt></a> configuration directives.</li>
784 <li>Unlike cookie and http, does not require a user to log in when first
785 loading the phpMyAdmin site. This is by design but could allow any
786 user to access your installation. Use of some restriction method is
787 suggested, perhaps a <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file with the HTTP-AUTH directive or disallowing
788 incoming HTTP requests at one’s router or firewall will suffice (both
789 of which are beyond the scope of this manual but easily searchable
790 with Google).</li>
791 </ul>
792 </div>
793 <div class="section" id="swekey-authentication-mode">
794 <span id="swekey"></span><span id="index-25"></span><h3>Swekey authentication mode<a class="headerlink" href="#swekey-authentication-mode" title="Permalink to this headline"></a></h3>
795 <p>The Swekey is a low cost authentication USB key that can be used in
796 web applications. When Swekey authentication is activated, phpMyAdmin
797 requires the users&#8217;s Swekey to be plugged before entering the login
798 page (currently supported for cookie authentication mode only). Swekey
799 Authentication is disabled by default. To enable it, add the following
800 line to <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>:</p>
801 <div class="highlight-php"><div class="highlight"><pre><span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_swekey_config&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;/etc/swekey.conf&#39;</span><span class="p">;</span>
802 </pre></div>
803 </div>
804 <p>You then have to create the <tt class="docutils literal"><span class="pre">swekey.conf</span></tt> file that will associate
805 each user with their Swekey Id. It is important to place this file
806 outside of your web server&#8217;s document root (in the example, it is
807 located in <tt class="docutils literal"><span class="pre">/etc</span></tt>). Feel free to use it with your own users&#8217;
808 information. If you want to purchase a Swekey please visit
809 <a class="reference external" href="https://www.phpmyadmin.net/auth_key/">https://www.phpmyadmin.net/auth_key/</a>
810 since this link provides funding for phpMyAdmin.</p>
811 <p>A self documented sample file is provided in the
812 file <tt class="file docutils literal"><span class="pre">examples/swekey.sample.conf</span></tt>:</p>
813 <div class="highlight-sh"><div class="highlight"><pre><span class="c"># This is a typical file used to enable Swekey hardware authentication.</span>
814 <span class="c">#</span>
815 <span class="c"># To activate the Swekey authentication add the following line to your config.inc.php file.</span>
816 <span class="c"># $cfg[&#39;Servers&#39;][$i][&#39;auth_swekey_config&#39;] = &#39;/etc/swekey-pma.conf&#39;;</span>
817 <span class="c"># Then rename this file &quot;swekey-pma.conf&quot; and copy it to the /etc directory.</span>
818 <span class="c"># Add all the Swekey ids you want to grant access to in the file.</span>
819 <span class="c"># After each Swekey id put the corresponding user name.</span>
820 <span class="c">#</span>
821 <span class="c"># If you don&#39;t know the id of a Swekey just visit http://www.swekey.com?sel=support</span>
822 <span class="c"># while your Swekey is connected.</span>
823 <span class="c">#</span>
824 <span class="c"># If you need to purchase a Swekey please visit https://www.phpmyadmin.net/auth_key/</span>
825 <span class="c"># since this link provides funding to PhpMyAdmin.</span>
826 <span class="c">#</span>
828 0000000000000000000000000000763A:root
829 000000000000000000000000000089E4:steve
830 0000000000000000000000000000231E:scott
832 <span class="c">#</span>
833 <span class="c"># It is recommended to include the following lines to contact the</span>
834 <span class="c"># authentication servers in SSL mode.</span>
835 <span class="c">#</span>
837 <span class="nv">SERVER_CHECK</span><span class="o">=</span>https://auth-check-ssl.musbe.net
838 <span class="nv">SERVER_RNDTOKEN</span><span class="o">=</span>https://auth-rnd-gen-ssl.musbe.net
839 <span class="nv">SERVER_STATUS</span><span class="o">=</span>https://auth-status-ssl.musbe.net
841 <span class="c">#</span>
842 <span class="c"># The path of the root certificate file used to ensure a secure</span>
843 <span class="c"># communication with the authentication servers in SSL mode.</span>
844 <span class="c"># If not specified, will use musbe-ca.crt found in your</span>
845 <span class="c"># phpMyAdmin/libraries/auth/swekey.</span>
846 <span class="c">#</span>
848 <span class="c">#CA_FILE=/var/http-root/phpmyadmin/libraries/auth/swekey/musbe-ca.crt</span>
850 <span class="c">#</span>
851 <span class="c"># If your server receives many login requests, you can enable the random</span>
852 <span class="c"># token caching to accelerate the authentication process.</span>
853 <span class="c"># Token caching is enabled by default.</span>
854 <span class="c">#</span>
856 <span class="c">#ENABLE_TOKEN_CACHE=0</span>
857 </pre></div>
858 </div>
859 <div class="admonition seealso">
860 <p class="first admonition-title">See also</p>
861 <p class="last"><span class="target" id="index-26"></span><a class="reference internal" href="config.html#cfg_Servers_auth_swekey_config"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['auth_swekey_config']</span></tt></a></p>
862 </div>
863 </div>
864 </div>
865 <div class="section" id="securing-your-phpmyadmin-installation">
866 <h2>Securing your phpMyAdmin installation<a class="headerlink" href="#securing-your-phpmyadmin-installation" title="Permalink to this headline"></a></h2>
867 <p>The phpMyAdmin team tries hard to make the application secure, however there
868 are always ways to make your installation more secure:</p>
869 <ul>
870 <li><p class="first">Remove the <tt class="docutils literal"><span class="pre">setup</span></tt> directory from phpMyAdmin, you will probably not
871 use it after the initial setup.</p>
872 </li>
873 <li><p class="first">Properly choose an authentication method - <a class="reference internal" href="#cookie"><em>Cookie authentication mode</em></a>
874 is probably the best choice for shared hosting.</p>
875 </li>
876 <li><p class="first">In case you don&#8217;t want all MySQL users to be able to access
877 phpMyAdmin, you can use <span class="target" id="index-27"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_rules"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['rules']</span></tt></a> to limit them.</p>
878 </li>
879 <li><p class="first">Consider hiding phpMyAdmin behind an authentication proxy, so that
880 users need to authenticate prior to providing MySQL credentials
881 to phpMyAdmin. You can achieve this by configuring your web server to request
882 HTTP authentication. For example in Apache this can be done with:</p>
883 <div class="highlight-apache"><div class="highlight"><pre><span class="nb">AuthType</span> Basic
884 <span class="nb">AuthName</span> <span class="s2">&quot;Restricted Access&quot;</span>
885 <span class="nb">AuthUserFile</span> <span class="sx">/usr/share/phpmyadmin/passwd</span>
886 <span class="nb">Require</span> valid-user
887 </pre></div>
888 </div>
889 <p>Once you have changed the configuration, you need to create a list of users which
890 can authenticate. This can be done using the <strong class="program">htpasswd</strong> utility:</p>
891 <div class="highlight-sh"><div class="highlight"><pre>htpasswd -c /usr/share/phpmyadmin/passwd username
892 </pre></div>
893 </div>
894 </li>
895 <li><p class="first">If you are afraid of automated attacks, enabling Captcha by
896 <span class="target" id="index-28"></span><a class="reference internal" href="config.html#cfg_CaptchaLoginPublicKey"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['CaptchaLoginPublicKey']</span></tt></a> and
897 <span class="target" id="index-29"></span><a class="reference internal" href="config.html#cfg_CaptchaLoginPrivateKey"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['CaptchaLoginPrivateKey']</span></tt></a> might be an option.</p>
898 </li>
899 </ul>
900 </div>
901 </div>
904 </div>
905 </div>
906 </div>
907 <div class="sphinxsidebar">
908 <div class="sphinxsidebarwrapper">
909 <h3><a href="index.html">Table Of Contents</a></h3>
910 <ul>
911 <li><a class="reference internal" href="#">Installation</a><ul>
912 <li><a class="reference internal" href="#linux-distributions">Linux distributions</a><ul>
913 <li><a class="reference internal" href="#debian">Debian</a></li>
914 <li><a class="reference internal" href="#opensuse">OpenSUSE</a></li>
915 <li><a class="reference internal" href="#ubuntu">Ubuntu</a></li>
916 <li><a class="reference internal" href="#gentoo">Gentoo</a></li>
917 <li><a class="reference internal" href="#mandriva">Mandriva</a></li>
918 <li><a class="reference internal" href="#fedora">Fedora</a></li>
919 <li><a class="reference internal" href="#red-hat-enterprise-linux">Red Hat Enterprise Linux</a></li>
920 </ul>
921 </li>
922 <li><a class="reference internal" href="#installing-on-windows">Installing on Windows</a></li>
923 <li><a class="reference internal" href="#quick-install">Quick Install</a><ul>
924 <li><a class="reference internal" href="#manually-creating-the-file">Manually creating the file</a></li>
925 <li><a class="reference internal" href="#using-setup-script">Using Setup script</a></li>
926 </ul>
927 </li>
928 <li><a class="reference internal" href="#verifying-phpmyadmin-releases">Verifying phpMyAdmin releases</a></li>
929 <li><a class="reference internal" href="#phpmyadmin-configuration-storage">phpMyAdmin configuration storage</a><ul>
930 <li><a class="reference internal" href="#zero-configuration">Zero configuration</a></li>
931 <li><a class="reference internal" href="#manual-configuration">Manual configuration</a></li>
932 </ul>
933 </li>
934 <li><a class="reference internal" href="#upgrading-from-an-older-version">Upgrading from an older version</a></li>
935 <li><a class="reference internal" href="#using-authentication-modes">Using authentication modes</a><ul>
936 <li><a class="reference internal" href="#http-authentication-mode">HTTP authentication mode</a></li>
937 <li><a class="reference internal" href="#cookie-authentication-mode">Cookie authentication mode</a></li>
938 <li><a class="reference internal" href="#signon-authentication-mode">Signon authentication mode</a></li>
939 <li><a class="reference internal" href="#config-authentication-mode">Config authentication mode</a></li>
940 <li><a class="reference internal" href="#swekey-authentication-mode">Swekey authentication mode</a></li>
941 </ul>
942 </li>
943 <li><a class="reference internal" href="#securing-your-phpmyadmin-installation">Securing your phpMyAdmin installation</a></li>
944 </ul>
945 </li>
946 </ul>
948 <h4>Previous topic</h4>
949 <p class="topless"><a href="require.html"
950 title="previous chapter">Requirements</a></p>
951 <h4>Next topic</h4>
952 <p class="topless"><a href="config.html"
953 title="next chapter">Configuration</a></p>
954 <h3>This Page</h3>
955 <ul class="this-page-menu">
956 <li><a href="_sources/setup.txt"
957 rel="nofollow">Show Source</a></li>
958 </ul>
959 <div id="searchbox" style="display: none">
960 <h3>Quick search</h3>
961 <form class="search" action="search.html" method="get">
962 <input type="text" name="q" />
963 <input type="submit" value="Go" />
964 <input type="hidden" name="check_keywords" value="yes" />
965 <input type="hidden" name="area" value="default" />
966 </form>
967 <p class="searchtip" style="font-size: 90%">
968 Enter search terms or a module, class or function name.
969 </p>
970 </div>
971 <script type="text/javascript">$('#searchbox').show(0);</script>
972 </div>
973 </div>
974 <div class="clearer"></div>
975 </div>
976 <div class="related">
977 <h3>Navigation</h3>
978 <ul>
979 <li class="right" style="margin-right: 10px">
980 <a href="genindex.html" title="General Index"
981 >index</a></li>
982 <li class="right" >
983 <a href="config.html" title="Configuration"
984 >next</a> |</li>
985 <li class="right" >
986 <a href="require.html" title="Requirements"
987 >previous</a> |</li>
988 <li><a href="index.html">phpMyAdmin 4.5.4.1 documentation</a> &raquo;</li>
989 </ul>
990 </div>
991 <div class="footer">
992 &copy; <a href="copyright.html">Copyright</a> 2012 - 2014, The phpMyAdmin devel team.
993 Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
994 </div>
995 </body>
996 </html>