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
10 // Template File: -none-
12 // Template Variables:
16 // Form POST \ GET Variables:
23 <title>Postfix Admin Setup Checker</title>
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 />
33 // Check for availablilty functions
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"));
49 // Check for PHP version
51 if ($f_phpversion == 1)
53 if (phpversion() < 5) $phpversion = 4;
54 if (phpversion() >= 5) $phpversion = 5;
55 print "- PHP version " . phpversion () . "<br />\n";
59 print "<li><b>Unable to check for PHP version. (missing function: phpversion())</b><br />\n";
64 // Check for Apache version
66 if ($f_apache_get_version == 1)
68 print "- " . apache_get_version() . "<br /><p />\n";
72 print "<li><b>Unable to check for Apache version. (missing function: apache_get_version())</b><br />\n";
76 print "Checking for dependencies:<br />\n";
80 // Check for Magic Quotes
82 if ($f_get_magic_quotes_gpc == 1)
84 if (get_magic_quotes_gpc () == 1)
86 print "- Magic Quotes: ON<br /><p />\n";
90 print "<li><b>Warning: Magic Quotes: OFF (using internal function!)</b><br /><p />\n";
95 print "<li><b>Unable to check for Magic Quotes. (missing function: get_magic_quotes_gpc())</b><br />\n";
101 // Check for config.inc.php
103 if ($file_config == 1)
105 print "- Depends on: presence config.inc.php - OK<br />\n";
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";
118 // Check if there is support for at least 1 database
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";
144 // MySQL 3.23, 4.0 functions
146 if ($f_mysql_connect == 1)
148 print "- Depends on: MySQL 3.23, 4.0 - OK<br />\n";
153 // MySQL 4.1 functions
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";
165 // PostgreSQL functions
167 if ($f_pg_connect == 1)
169 print "- Depends on: PostgreSQL - OK (change the database_type in config.inc.php!!)<br />\n";
176 if ($f_session_start == 1)
178 print "- Depends on: session - OK<br />\n";
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";
195 if ($f_preg_match == 1)
197 print "- Depends on: pcre - OK<br />\n";
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";
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";