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