Blob


1 <?php
2 //
3 // Postfix Admin
4 // by Mischa Peters <mischa at high5 dot net>
5 // Copyright (c) 2002 - 2005 High5!
6 // License Info: http://www.postfixadmin.com/?file=LICENSE.TXT
7 //
8 // File: index.php
9 //
10 // Template File: -none-
11 //
12 // Template Variables:
13 //
14 // -none-
15 //
16 // Form POST \ GET Variables:
17 //
18 // -none-
19 //
20 ?>
21 <html>
22 <head>
23 <title>Postfix Admin Setup Checker</title>
24 </head>
25 <body>
26 <img id="login_header_logo" src="images/postbox.png" />
27 <img id="login_header_logo" src="images/postfixadmin2.png" />
28 <h2>Postfix Admin Setup Checker 1.0.0</h2>
29 Running software:<br />
30 <p />
31 <?php
32 //
33 // Check for availablilty functions
34 //
35 $f_phpversion = function_exists ("phpversion");
36 $f_apache_get_version = function_exists ("apache_get_version");
37 $f_get_magic_quotes_gpc = function_exists ("get_magic_quotes_gpc");
38 $f_mysql_connect = function_exists ("mysql_connect");
39 $f_mysqli_connect = function_exists ("mysqli_connect");
40 $f_pg_connect = function_exists ("pg_connect");
41 $f_session_start = function_exists ("session_start");
42 $f_preg_match = function_exists ("preg_match");
44 $file_config = file_exists (realpath ("./config.inc.php"));
46 $error = 0;
48 //
49 // Check for PHP version
50 //
51 if ($f_phpversion == 1)
52 {
53 if (phpversion() < 5) $phpversion = 4;
54 if (phpversion() >= 5) $phpversion = 5;
55 print "- PHP version " . phpversion () . "<br />\n";
56 }
57 else
58 {
59 print "<li><b>Unable to check for PHP version. (missing function: phpversion())</b><br />\n";
60 }
61 print "<p />\n";
63 //
64 // Check for Apache version
65 //
66 if ($f_apache_get_version == 1)
67 {
68 print "- " . apache_get_version() . "<br /><p />\n";
69 }
70 else
71 {
72 print "<li><b>Unable to check for Apache version. (missing function: apache_get_version())</b><br />\n";
73 }
74 print "<p />\n";
76 print "Checking for dependencies:<br />\n";
77 print "<p />\n";
79 //
80 // Check for Magic Quotes
81 //
82 if ($f_get_magic_quotes_gpc == 1)
83 {
84 if (get_magic_quotes_gpc () == 1)
85 {
86 print "- Magic Quotes: ON<br /><p />\n";
87 }
88 else
89 {
90 print "<li><b>Warning: Magic Quotes: OFF (using internal function!)</b><br /><p />\n";
91 }
92 }
93 else
94 {
95 print "<li><b>Unable to check for Magic Quotes. (missing function: get_magic_quotes_gpc())</b><br />\n";
96 }
97 print "<p />\n";
100 //
101 // Check for config.inc.php
102 //
103 if ($file_config == 1)
105 print "- Depends on: presence config.inc.php - OK<br />\n";
107 else
109 print "<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br />\n";
110 print "Create the file.<br />";
111 print "For example:<br />\n";
112 print "<pre>% cp config.inc.php.sample config.inc.php</pre>\n";
113 $error =+ 1;
115 print "<p />\n";
117 //
118 // Check if there is support for at least 1 database
119 //
120 if (($f_mysql_connect == 0) and ($f_mysqli_connect == 0) and ($f_pg_connect == 0))
122 print "<li><b>Error: There is no database support in your PHP setup</b><br />\n";
123 print "To install MySQL 3.23 or 4.0 support on FreeBSD:<br />\n";
124 print "<pre>% cd /usr/ports/databases/php$phpversion-mysql/\n";
125 print "% make clean install\n";
126 print " - or with portupgrade -\n";
127 print "% portinstall php$phpversion-mysql</pre>\n";
128 if ($phpversion >= 5)
130 print "To install MySQL 4.1 support on FreeBSD:<br />\n";
131 print "<pre>% cd /usr/ports/databases/php5-mysqli/\n";
132 print "% make clean install\n";
133 print " - or with portupgrade -\n";
134 print "% portinstall php5-mysqli</pre>\n";
136 print "To install PostgreSQL support on FreeBSD:<br />\n";
137 print "<pre>% cd /usr/ports/databases/php$phpversion-pgsql/\n";
138 print "% make clean install\n";
139 print " - or with portupgrade -\n";
140 print "% portinstall php$phpversion-pgsql</pre>\n";
141 $error =+ 1;
143 //
144 // MySQL 3.23, 4.0 functions
145 //
146 if ($f_mysql_connect == 1)
148 print "- Depends on: MySQL 3.23, 4.0 - OK<br />\n";
150 print "<p />\n";
152 //
153 // MySQL 4.1 functions
154 //
155 if ($phpversion >= 5)
157 if ($f_mysqli_connect == 1)
159 print "- Depends on: MySQL 4.1 - OK (change the database_type in config.inc.php!!)<br />\n";
162 print "<p />\n";
164 //
165 // PostgreSQL functions
166 //
167 if ($f_pg_connect == 1)
169 print "- Depends on: PostgreSQL - OK (change the database_type in config.inc.php!!)<br />\n";
171 print "<p />\n";
173 //
174 // Session functions
175 //
176 if ($f_session_start == 1)
178 print "- Depends on: session - OK<br />\n";
180 else
182 print "<li><b>Error: Depends on: session - NOT FOUND</b><br />\n";
183 print "To install session support on FreeBSD:<br />\n";
184 print "<pre>% cd /usr/ports/www/php$phpversion-session/\n";
185 print "% make clean install\n";
186 print " - or with portupgrade -\n";
187 print "% portinstall php$phpversion-session</pre>\n";
188 $error =+ 1;
190 print "<p />\n";
192 //
193 // PCRE functions
194 //
195 if ($f_preg_match == 1)
197 print "- Depends on: pcre - OK<br />\n";
199 else
201 print "<li><b>Error: Depends on: pcre - NOT FOUND</b><br />\n";
202 print "To install pcre support on FreeBSD:<br />\n";
203 print "<pre>% cd /usr/ports/devel/php$phpversion-pcre/\n";
204 print "% make clean install\n";
205 print " - or with portupgrade -\n";
206 print "% portinstall php$phpversion-pcre</pre>\n";
207 $error =+ 1;
209 print "<p />\n";
211 if ($error == 0)
213 print "Everything seems fine... you are ready to rock & roll!</br>\n";
214 print "<b>Make sure you delete this setup.php file!</b><br />\n";
215 print "Also check the config.inc.php file for any settings that you might need to change!<br />\n";
216 print "Click here to go to the <a href=\"admin\">admin section</a> (make sure that your .htaccess is setup properly)\n";
218 ?>
219 </body>
220 </html>