2 //required for normal operation because of recent changes in PHP:
5 //turn off PHP compatibility warnings
6 ini_set("session.bug_compat_warn","off");
10 $state = $_POST["state"];
12 //If having problems with file and directory permission
13 // checking, then can be manually disabled here.
14 $checkPermissions = "TRUE";
16 //Below section is only for variables that require a path.
17 // The $manualPath variable can be edited by 3rd party
18 // installation scripts to manually set path. (this will
19 // allow straightforward use of this script by 3rd party
22 $dumpfile = $manualPath."sql/database.sql";
23 $translations_dumpfile_utf8 = $manualPath."contrib/util/language_translations/currentLanguage_utf8.sql";
24 $translations_dumpfile_latin1 = $manualPath."contrib/util/language_translations/currentLanguage_latin1.sql";
25 $icd9 = $manualPath."sql/icd9.sql";
26 $conffile = $manualPath."library/sqlconf.php";
27 $conffile2 = $manualPath."interface/globals.php";
28 $docsDirectory = $manualPath."documents";
29 $billingDirectory = $manualPath."edi";
30 $billingDirectory2 = $manualPath."era";
31 $billingLogDirectory = $manualPath."library/freeb";
32 $lettersDirectory = $manualPath."custom/letter_templates";
33 $gaclWritableDirectory = $manualPath."gacl/admin/templates_c";
34 $requiredDirectory1 = $manualPath."interface/main/calendar/modules/PostCalendar/pntemplates/compiled";
35 $requiredDirectory2 = $manualPath."interface/main/calendar/modules/PostCalendar/pntemplates/cache";
36 $gaclSetupScript1 = $manualPath."gacl/setup.php";
37 $gaclSetupScript2 = $manualPath."acl_setup.php";
39 //These are files and dir checked before install for
40 // correct permissions.
41 $writableFileList = array($conffile, $conffile2);
42 $writableDirList = array($docsDirectory, $billingDirectory, $billingDirectory2, $billingLogDirectory, $lettersDirectory, $gaclWritableDirectory, $requiredDirectory1, $requiredDirectory2);
44 //These are the dumpfiles that are loaded into database
45 // The subsequent array holds the title of dumpfiles
46 $dumpfiles = array($dumpfile);
47 $dumpfilesTitles = array("Main");
49 include_once($conffile);
53 <TITLE
>OpenEMR Setup Tool
</TITLE
>
54 <LINK REL
=STYLESHEET HREF
="interface/themes/style_blue.css">
58 <span
class="title">OpenEMR Setup
</span
>
63 if (strtolower(ini_get('register_globals')) != 'off' && (bool) ini_get('register_globals')) {
64 echo "It appears that you have register_globals enabled in your php.ini\n" .
65 "configuration file. This causes unacceptable security risks. You must\n" .
66 "turn it off before continuing with installation.\n";
75 <p
>Congratulations
! OpenEMR is now installed
.</p
>
78 <li
>Access
controls (php
-GACL
) are installed
for fine
-grained security
, and can be administered in
79 OpenEMR
's admin->acl menu.</li>
80 <li>Reading openemr/includes/config.php and openemr/interface/globals.php is a good idea. These files
81 contain many options to choose from including themes.</li>
82 <li>There's much information
and many extra tools bundled within the OpenEMR installation directory
.
83 Please refer to openemr
/Documentation
. Many forms
and other useful scripts can be found at openemr
/contrib
.</li
>
84 <li
>To ensure a consistent look
and feel through out the application using
85 <a href
='http://www.mozilla.org/products/firefox/'>Firefox
</a
> is recommended
.</li
>
86 <li
>The OpenEMR project home page
and wiki can be found at
<a href
= "http://www.oemr.org" target
="_blank">http
://www.oemr.org</a></li>
87 <li
>The OpenEMR forums can be found at
<a href
= "http://sourceforge.net/projects/openemr" target
="_blank">http
://sourceforge.net/projects/openemr</a></li>
88 <li
>We pursue grants to help fund the future development of OpenEMR
. To apply
for these grants
, we need to estimate how many times this program is installed
and how many practices are evaluating
or using this software
. It would be awesome
if you would email us at
<a href
="mailto:drbowen@charter.net">drbowen@charter
.net
</a
> if you have installed this software
. The more details about your plans with this software
, the better
, but even just sending us an email stating you just installed it is very helpful
.</li
>
91 We recommend you
print these instructions
for future reference
.
94 <b
>The initial OpenEMR user is
"<?php echo $iuser; ?>" and the password is
"pass".</b
>
95 You should change this password
!
98 If you edited the PHP
or Apache configuration files during this installation process
, then we recommend you restart your Apache server before following below OpenEMR link
.
101 <a href
='./'>Click here to start using OpenEMR
. </a
>
111 $server = $_POST["server"];
112 $port = $_POST["port"];
113 $dbname = $_POST["dbname"];
114 $root = $_POST["root"];
115 $login = $_POST["login"];
116 $pass = $_POST["pass"];
117 $loginhost = $_POST["loginhost"];
118 $collate = $_POST["collate"];
119 $rootpass = $_POST["rootpass"];
120 $iuser = $_POST["iuser"];
121 $iuname = $_POST["iuname"];
122 $igroup = $_POST["igroup"];
123 $openemrBasePath = $_POST["openemrBasePath"];
124 $openemrWebPath = $_POST["openemrWebPath"];
128 if (($config == 1) && ($state < 4)) {
129 echo "OpenEMR has already been installed. If you wish to force re-installation, then edit $conffile(change the 'config' variable to 0), and re-run this script.<br>\n";
135 echo "<b>Step $state</b><br><br>\n";
136 echo "Now I need to know whether you want me to create the database on my own or if you have already created the database for me to use. For me to create the database, you will need to supply the MySQL root password.\n
137 <span class='title'> <br />NOTE: clicking on \"Continue\" may delete or cause damage to data on your system. Before you continue please backup your data.</span>
139 <FORM METHOD='POST'>\n
140 <INPUT TYPE='HIDDEN' NAME='state' VALUE='2'>\n
141 <INPUT TYPE='RADIO' NAME='inst' VALUE='1' checked>Have setup create the database<br>\n
142 <INPUT TYPE='RADIO' NAME='inst' VALUE='2'>I have already created the database<br>\n
144 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>\n";
148 echo "<b>Step $state</b><br><br>\n";
149 echo "Now you need to supply the MySQL server information and path information. Detailed instructions on each item can be found in the <a href='INSTALL' target='_blank'><span STYLE='text-decoration: underline;'>'INSTALL'</span></a> manual file.
152 <INPUT TYPE='HIDDEN' NAME='state' VALUE='3'>
153 <INPUT TYPE='HIDDEN' NAME='inst' VALUE='$inst'>
155 <TR VALIGN='TOP'><TD COLSPAN=2><font color='red'>MYSQL SERVER:</font></TD></TR>
156 <TR VALIGN='TOP'><TD><span class='text'>Server Host: </span></TD><TD><INPUT TYPE='TEXT' VALUE='localhost' NAME='server' SIZE='30'></TD><TD><span class='text'>(If you run MySQL and Apache/PHP on the same computer, then leave this as 'localhost'. If they are on separate computers, then enter the IP address of the computer running MySQL.)</span><br></TD></TR>
157 <TR VALIGN='TOP'><TD><span class='text'>Server Port: </span></TD><TD><INPUT TYPE='TEXT' VALUE='3306' NAME='port' SIZE='30'></TD><TD><span class='text'>(This is the MySQL port. The default port for MySQL is 3306.)</span><br></TD></TR>
158 <TR VALIGN='TOP'><TD><span class='text'>Database Name: </span></TD><TD><INPUT TYPE='TEXT' VALUE='openemr' NAME='dbname' SIZE='30'></TD><TD><span class='text'>(This is the name of the OpenEMR database in MySQL - 'openemr' is the recommended)</span><br></TD></TR>
159 <TR VALIGN='TOP'><TD><span class='text'>Login Name: </span></TD><TD><INPUT TYPE='TEXT' VALUE='openemr' NAME='login' SIZE='30'></TD><TD><span class='text'>(This is the name of the OpenEMR login name in MySQL - 'openemr' is the recommended)</span><br></TD></TR>
160 <TR VALIGN='TOP'><TD><span class='text'>Password: </span></TD><TD><INPUT TYPE='PASSWORD' VALUE='' NAME='pass' SIZE='30'></TD><TD><span class='text'>(This is the Login Password for when PHP accesses MySQL - it should be at least 8 characters long and composed of both numbers and letters)</span><br></TD></TR>\n";
162 echo "<TR VALIGN='TOP'><TD><span class='text'>Name for Root Account: </span></TD><TD><INPUT TYPE='TEXT' VALUE='root' NAME='root' SIZE='30'></TD><TD><span class='text'>(This is name for MySQL root account. For localhost, it is usually ok to leave it 'root'.)</span><br></TD></TR>
163 <TR VALIGN='TOP'><TD><span class='text'>Root Pass: </span></TD><TD><INPUT TYPE='PASSWORD' VALUE='' NAME='rootpass' SIZE='30'></TD><TD><span class='text'>(This is your MySQL root password. For localhost, it is usually ok to leave it blank.)</span><br></TD></TR>\n";
164 echo "<TR VALIGN='TOP'><TD><span class='text'>User Hostname: </span></TD><TD><INPUT TYPE='TEXT' VALUE='localhost' NAME='loginhost' SIZE='30'></TD><TD><span class='text'>(If you run Apache/PHP and MySQL on the same computer, then leave this as 'localhost'. If they are on separate computers, then enter the IP address of the computer running Apache/PHP.)</span><br></TD></TR>";
165 echo "<TR VALIGN='TOP'><TD><span class='text'>UTF-8 Collation: </span></TD><TD colspan='2'>" .
166 "<select name='collate'>" .
167 "<option value='utf8_bin' >Bin</option>" .
168 "<option value='utf8_czech_ci' >Czech</option>" .
169 "<option value='utf8_danish_ci' >Danish</option>" .
170 "<option value='utf8_esperanto_ci' >Esperanto</option>" .
171 "<option value='utf8_estonian_ci' >Estonian</option>" .
172 "<option value='utf8_general_ci' selected>General</option>" .
173 "<option value='utf8_hungarian_ci' >Hungarian</option>" .
174 "<option value='utf8_icelandic_ci' >Icelandic</option>" .
175 "<option value='utf8_latvian_ci' >Latvian</option>" .
176 "<option value='utf8_lithuanian_ci'>Lithuanian</option>" .
177 "<option value='utf8_persian_ci' >Persian</option>" .
178 "<option value='utf8_polish_ci' >Polish</option>" .
179 "<option value='utf8_roman_ci' >Roman</option>" .
180 "<option value='utf8_romanian_ci' >Romanian</option>" .
181 "<option value='utf8_slovak_ci' >Slovak</option>" .
182 "<option value='utf8_slovenian_ci' >Slovenian</option>" .
183 "<option value='utf8_spanish2_ci' >Spanish2 (Traditional)</option>" .
184 "<option value='utf8_spanish_ci' >Spanish (Modern)</option>" .
185 "<option value='utf8_swedish_ci' >Swedish</option>" .
186 "<option value='utf8_turkish_ci' >Turkish</option>" .
187 "<option value='utf8_unicode_ci' >Unicode (German, French, Russian, Armenian, Greek)</option>" .
188 "<option value='' >None (Do not force UTF-8)</option>" .
190 "</TD></TR><TR VALIGN='TOP'><TD> </TD><TD colspan='2'><span class='text'>(This is the collation setting for mysql. Leave as 'General' if you are not sure. If the language you are planning to use in OpenEMR is in the menu, then you can select it. Otherwise, just select 'General'.)</span><br></TD></TR>";
192 echo "<TR VALIGN='TOP'><TD> </TD></TR>";
193 echo "<TR VALIGN='TOP'><TD COLSPAN=2><font color='red'>OPENEMR USER:</font></TD></TR>";
194 echo "<TR VALIGN='TOP'><TD><span class='text'>Initial User:</span></TD><TD><INPUT SIZE='30' TYPE='TEXT' NAME='iuser' VALUE='admin'></TD><TD><span class='text'>(This is the login name of user that will be created for you. Limit this to one word.)</span></TD></TR>
195 <TR VALIGN='TOP'><TD><span class='text'>Initial User's Name:</span></TD><TD><INPUT SIZE='30' TYPE='TEXT' NAME='iuname' VALUE='Administrator'></TD><TD><span class='text'>(This is the real name of the 'initial user'.)</span></TD></TR>
196 <TR VALIGN='TOP'><TD><span class='text'>Initial Group:</span></TD><TD><INPUT SIZE='30' TYPE='TEXT' NAME='igroup' VALUE='Default'></TD><TD><span class='text'>(This is the group that will be created for your users. This should be the name of your practice.)</span></TD></TR>
198 echo "<TR VALIGN='TOP'><TD> </TD></TR>";
199 echo "<TR VALIGN='TOP'><TD COLSPAN=2><font color='red'>OPENEMR PATHS:</font></TD></TR>";
200 echo "<TR VALIGN='TOP'><TD COLSPAN=3></TD></TR>
201 <TR VALIGN='TOP'><TD><span class='text'>Absolute Path:</span></TD><TD><INPUT SIZE='30' TYPE='TEXT' NAME='openemrBasePath' VALUE='".realpath('./')."'></TD><TD><span class='text'>(This is the full absolute directory path to openemr. The value here is automatically created, and should not need to be modified. Do not worry about direction of slashes; they will be automatically corrected.)</span></TD></TR>
202 <TR VALIGN='TOP'><TD><span class='text'>Relative HTML Path:</span></TD><TD><INPUT SIZE='30' TYPE='TEXT' NAME='openemrWebPath' VALUE='/openemr'></TD><TD><span class='text'>(Set this to the relative html path, ie. what you would type into the web browser after the server address to get to OpenEMR. For example, if you type 'http://127.0.0.1/clinic/openemr/ to load OpenEMR, set this to '/clinic/openemr' without the trailing slash. Do not worry about direction of slashes; they will be automatically corrected.)</span></TD></TR>
206 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>";
213 if ($login == "" ||
!isset($login)) {
214 echo "ERROR. Please pick a proper 'Login Name'.<br>\n";
215 echo "Click Back in browser to re-enter.<br>\n";
218 if (strpos($iuser, " ")) {
219 echo "ERROR. The 'Initial User' field can only contain one word and no spaces.<br>\n";
220 echo "Click Back in browser to re-enter.<br>\n";
223 if ($pass == "" ||
!isset($pass)) {
224 echo "ERROR. Please pick a proper 'Password'.<br>\n";
225 echo "Click Back in browser to re-enter.<br>\n";
229 echo "<b>Step $state</b><br><br>\n";
230 echo "Configuring OpenEMR...<br><br>\n";
234 echo "Connecting to MySQL Server...\n";
236 if ($server == "localhost")
237 $dbh = mysql_connect("$server","$root","$rootpass");
239 $dbh = mysql_connect("$server:$port","$root","$rootpass");
241 echo "ERROR. Check your login credentials.\n";
242 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
247 echo "Creating database...\n";
249 $sql = "create database $dbname";
251 $sql .= " character set utf8 collate $collate";
252 mysql_query("SET NAMES 'utf8'", $dbh);
254 if (mysql_query($sql, $dbh) == FALSE) {
255 echo "ERROR. Check your login credentials.\n";
256 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
261 echo "Creating user with permissions for database...\n";
263 if (mysql_query("GRANT ALL PRIVILEGES ON $dbname.* TO '$login'@'$loginhost' IDENTIFIED BY '$pass'",$dbh) == FALSE) {
264 echo "ERROR when granting privileges to the specified user.\n";
265 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
271 echo "Reconnecting as new user...\n";
275 echo "Connecting to MySQL Server...\n";
277 if ($server == "localhost")
278 $dbh = mysql_connect("$server","$login","$pass");
280 $dbh = mysql_connect("$server:$port","$login","$pass");
283 echo "ERROR. Check your login credentials.\n";
284 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
289 mysql_query("SET NAMES 'utf8'", $dbh);
293 echo "Opening database...";
295 if (mysql_select_db("$dbname",$dbh) == FALSE) {
296 echo "ERROR. Check your login credentials.\n";
297 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
305 //select the correct translation dumpfile
307 array_push($dumpfiles,$translations_dumpfile_utf8);
308 array_push($dumpfilesTitles,"Language Translation (utf8)");
311 array_push($dumpfiles,$translations_dumpfile_latin1);
312 array_push($dumpfilesTitles,"Language Translation (latin1)");
315 $dumpfileCounter = 0;
316 foreach ($dumpfiles as $var) {
317 echo "Creating ".$dumpfilesTitles[$dumpfileCounter]." tables...\n";
318 mysql_query("USE $dbname",$dbh);
320 $fd = fopen($var, 'r');
322 echo "ERROR. Could not open dumpfile '$dumpfile'.\n";
329 $line = fgets($fd,1024);
330 $line = rtrim($line);
331 if (substr($line,0,2) == "--") // Kill comments
333 if (substr($line,0,1) == "#") // Kill comments
337 $query = $query.$line; // Check for full query
338 $chr = substr($query,strlen($query)-1,1);
339 if ($chr == ";") { // valid query, execute
340 $query = rtrim($query,";");
341 mysql_query("$query",$dbh);
350 echo "Adding Initial User...\n";
352 //echo "INSERT INTO groups VALUES (1,'$igroup','$iuser')<br>\n";
353 if (mysql_query("INSERT INTO groups (id, name, user) VALUES (1,'$igroup','$iuser')") == FALSE) {
354 echo "ERROR. Could not run queries.\n";
355 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
359 if (mysql_query("INSERT INTO users (id, username, password, authorized, lname, fname, facility_id) VALUES (1,'$iuser','1a1dc91c907325c69271ddf0c944bc72',1,'$iuname','',3)") == FALSE) {
360 echo "ERROR. Could not run queries.\n";
361 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
367 /* echo "Inserting ICD-9-CM Codes into Database...\n";
369 $fd = fopen($icd9, 'r');
371 echo "ERROR. Could not open dumpfile.\n";
372 echo "<p>".mysql_error()." (#".mysql_errno().")\n";
379 $line = fgets($fd,1024);
380 $line = rtrim($line);
381 if (substr($line,0,2) == "--") // Kill comments
383 if (substr($line,0,1) == "#") // Kill comments
387 $query = $query.$line; // Check for full query
388 $chr = substr($query,strlen($query)-1,1);
389 if ($chr == ";") { // valid query, execute
390 $query = rtrim($query,";");
391 mysql_query("$query",$dbh);
400 echo "<br>Writing SQL Configuration...<br>";
401 @touch
($conffile); // php bug
402 $fd = @fopen
($conffile, 'w');
406 // Referenced from sql.inc
410 $it_died = 0; //fmg: variable keeps running track of any errors
412 fwrite($fd,$string) or $it_died++
;
413 fwrite($fd,"\$host\t= '$server';\n") or $it_died++
;
414 fwrite($fd,"\$port\t= '$port';\n") or $it_died++
;
415 fwrite($fd,"\$login\t= '$login';\n") or $it_died++
;
416 fwrite($fd,"\$pass\t= '$pass';\n") or $it_died++
;
417 fwrite($fd,"\$dbase\t= '$dbname';\n\n") or $it_died++
;
418 fwrite($fd,"//Added ability to disable\n") or $it_died++
;
419 fwrite($fd,"//utf8 encoding - bm 05-2009\n") or $it_died++
;
420 fwrite($fd,"\$disable_utf8_flag = false;\n") or $it_died++
;
424 $sqlconf["host"]= $host;
425 $sqlconf["port"] = $port;
426 $sqlconf["login"] = $login;
427 $sqlconf["pass"] = $pass;
428 $sqlconf["dbase"] = $dbase;
429 //////////////////////////
430 //////////////////////////
431 //////////////////////////
432 //////DO NOT TOUCH THIS///
433 $config = 1; /////////////
434 //////////////////////////
435 //////////////////////////
436 //////////////////////////
439 ?
><?php
// done just for coloring
441 fwrite($fd,$string) or $it_died++
;
443 //it's rather irresponsible to not report errors when writing this file.
445 echo "ERROR. Couldn't write $it_died lines to config file '$conffile'.\n";
451 echo "Successfully wrote SQL configuration.<BR><br>";
453 echo "Writing OpenEMR webserver paths to config file...<br>";
454 //edit interface/globals.php
455 //first, ensure slashes are in correct direction (windows specific fix)
456 $openemrBasePath = str_replace('\\\\', '/', $openemrBasePath);
457 $openemrBasePath = str_replace('\\', '/', $openemrBasePath);
458 $openemrWebPath = str_replace('\\\\', '/', $openemrWebPath);
459 $openemrWebPath = str_replace('\\', '/', $openemrWebPath);
460 //second, edit file (web paths and set UTF8 if pertinent)
461 $data = file($conffile2) or die("Could not read ".$conffile2." file.");
464 foreach ($data as $line) {
466 if ((strpos($line,"\$webserver_root = \"")) === false) {
471 $finalData .= "\$webserver_root = \"$openemrBasePath\";\n";
473 if ((strpos($line,"\$web_root = \"")) === false) {
478 $finalData .= "\$web_root = \"$openemrWebPath\";\n";
484 $fd = @fopen
($conffile2, 'w') or die("Could not open ".$conffile2." file.");
485 fwrite($fd, $finalData);
488 echo "Successfully wrote OpenEMR webserver paths to config file<br><br>";
491 echo "<FONT COLOR='red'>ERROR</FONT> writing openemr webserver root paths to config file ($conffile2). ($isCount)<br><br>\n";
494 echo "\n<br>Next step will install and configure access controls (php-GACL).<br>\n";
497 <FORM METHOD='POST'>\n
498 <INPUT TYPE='HIDDEN' NAME='state' VALUE='4'>
499 <INPUT TYPE='HIDDEN' NAME='iuser' VALUE='$iuser'>
500 <INPUT TYPE='HIDDEN' NAME='iuname' VALUE='$iuname'>
502 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>\n";
508 echo "<b>Step $state</b><br><br>\n";
509 echo "Installing and Configuring Access Controls (php-GACL)...<br><br>";
511 //run gacl config scripts, all sql config data now in sqlconf.php file
512 require $gaclSetupScript1;
513 require $gaclSetupScript2;
516 //give the administrator user admin priviledges
517 $groupArray = array("Administrators");
518 set_user_aro($groupArray,$iuser,$iuname,"","");
519 echo "Gave the '$iuser' user (password is 'pass') administrator access.<br><br>";
521 echo "Done installing and configuring access controls (php-GACL).<br>";
522 echo "Next step will configure PHP.";
524 echo "<br><FORM METHOD='POST'>\n
525 <INPUT TYPE='HIDDEN' NAME='state' VALUE='5'>\n
526 <INPUT TYPE='HIDDEN' NAME='iuser' VALUE='$iuser'>\n
528 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>\n";
533 echo "<b>Step $state</b><br><br>\n";
534 echo "Configuration of PHP...<br><br>\n";
535 echo "We recommend making the following changes to your PHP installation, which can normally be done by editing the php.ini configuration file:\n";
538 if (version_compare(PHP_VERSION
, '5.2.4', '>=')) {
539 $phpINIfile = php_ini_loaded_file();
541 echo "<li><font color='green'>Your php.ini file can be found at ".$phpINIfile."</font></li>\n";
545 echo "<li>To ensure proper functioning of OpenEMR you must make sure that settings in php.ini file include \"short_open_tag = On\", \"display_errors = Off\", \"register_globals = Off\", \"magic_quotes_gpc = On\", \"max_execution_time\" set to at least 60, \"max_input_time\" set to at least 90, and \"memory_limit\" set to at least \"128M\".</li>\n";
546 echo "<li>In order to take full advantage of the patient documents capability you must make sure that settings in php.ini file include \"file_uploads = On\", that \"upload_max_filesize\" is appropriate for your use and that \"upload_tmp_dir\" is set to a correct value that will work on your system.</li>\n";
548 echo "<li>If you are having difficulty finding your php.ini file, then refer to the <a href='INSTALL' target='_blank'><span STYLE='text-decoration: underline;'>'INSTALL'</span></a> manual for suggestions.</li>\n";
552 echo "<br>We recommend you print these instructions for future reference.<br><br>";
553 echo "Next step will configure Apache web server.";
555 echo "<br><FORM METHOD='POST'>\n
556 <INPUT TYPE='HIDDEN' NAME='state' VALUE='6'>\n
557 <INPUT TYPE='HIDDEN' NAME='iuser' VALUE='$iuser'>\n
559 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>\n";
564 echo "<b>Step $state</b><br><br>\n";
565 echo "Configuration of Apache web server...<br><br>\n";
566 echo "The \"".realpath($docsDirectory)."\", \"".realpath($billingDirectory)."\" and \"".realpath($billingDirectory2)."\" directories contain patient information, and
567 it is important to secure these directories. This can be done by placing pertinent .htaccess
568 files in these directories or by pasting the below to end of your apache configuration file:<br>
569 <Directory ".realpath($docsDirectory)."><br>
570 order deny,allow<br>
571 Deny from all<br>
572 </Directory><br>
573 <Directory ".realpath($billingDirectory)."><br>
574 order deny,allow<br>
575 Deny from all<br>
576 </Directory><br>
577 <Directory ".realpath($billingDirectory2)."><br>
578 order deny,allow<br>
579 Deny from all<br>
580 </Directory><br><br>";
582 echo "If you are having difficulty finding your apache configuration file, then refer to the <a href='INSTALL' target='_blank'><span STYLE='text-decoration: underline;'>'INSTALL'</span></a> manual for suggestions.<br><br>\n";
583 echo "<br>We recommend you print these instructions for future reference.<br><br>";
584 echo "Click 'continue' for further instructions.";
586 echo "<br><FORM METHOD='POST'>\n
587 <INPUT TYPE='HIDDEN' NAME='state' VALUE='7'>\n
588 <INPUT TYPE='HIDDEN' NAME='iuser' VALUE='$iuser'>\n
590 <INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>\n";
596 echo "<p>Welcome to OpenEMR. This utility will step you through the installation and configuration of OpenEMR for your practice.</p>\n";
597 echo "<ul><li>Before proceeding, be sure that you have a properly installed and configured MySQL server available, and a PHP configured webserver.</li>\n";
599 echo "<li>Detailed installation instructions can be found in the <a href='INSTALL' target='_blank'><span STYLE='text-decoration: underline;'>'INSTALL'</span></a> manual file.</li>\n";
601 Echo "<li>If you are upgrading from a previous version, do NOT use this script. Please read the 'Upgrading' section found in the <a href='INSTALL' target='_blank'><span STYLE='text-decoration: underline;'>'INSTALL'</span></a> manual file.</li></ul>";
603 if ($checkPermissions == "TRUE") {
604 echo "<p>We will now ensure correct file and directory permissions before starting installation:</p>\n";
605 echo "<FONT COLOR='green'>Ensuring following files are world-writable...</FONT><br>\n";
607 foreach ($writableFileList as $tempFile) {
608 if (is_writable($tempFile)) {
609 echo "'".realpath($tempFile)."' file is <FONT COLOR='green'><b>ready</b></FONT>.<br>\n";
612 echo "<p><FONT COLOR='red'>UNABLE</FONT> to open file '".realpath($tempFile)."' for writing.<br>\n";
613 echo "(configure file permissions; see below for further instructions)</p>\n";
617 if ($errorWritable) {
618 echo "<p><FONT COLOR='red'>You can't proceed until all above files are ready (world-writable).</FONT><br>\n";
619 echo "In linux, recommend changing file permissions with the 'chmod 666 filename' command.<br>\n";
620 echo "Fix above file permissions and then click the 'Check Again' button to re-check files.<br>\n";
621 echo "<FORM METHOD='POST'><INPUT TYPE='SUBMIT' VALUE='Check Again'></p></FORM><br>\n";
625 echo "<br><FONT COLOR='green'>Ensuring following directories have proper permissions...</FONT><br>\n";
627 foreach ($writableDirList as $tempDir) {
628 if (is_writable($tempDir)) {
629 echo "'".realpath($tempDir)."' directory is <FONT COLOR='green'><b>ready</b></FONT>.<br>\n";
632 echo "<p><FONT COLOR='red'>UNABLE</FONT> to open directory '".realpath($tempDir)."' for writing by web server.<br>\n";
633 echo "(configure directory permissions; see below for further instructions)</p>\n";
637 if ($errorWritable) {
638 echo "<p><FONT COLOR='red'>You can't proceed until all directories are ready.</FONT><br>\n";
639 echo "In linux, recommend changing owners of these directories to the web server. For example, in many linux OS's the web server user is 'apache', 'nobody', or 'www-data'. So if 'apache' were the web server user name, could use the command 'chown -R apache:apache directory_name' command.<br>\n";
640 echo "Fix above directory permissions and then click the 'Check Again' button to re-check directories.<br>\n";
641 echo "<FORM METHOD='POST'><INPUT TYPE='SUBMIT' VALUE='Check Again'></p></FORM><br>\n";
645 echo "<br>All required files and directories have been verified. Click to continue installation.<br>\n";
648 echo "<br>Click to continue installation.<br>\n";
651 echo "<FORM METHOD='POST'><INPUT TYPE='HIDDEN' NAME='state' VALUE='1'><INPUT TYPE='SUBMIT' VALUE='Continue'><br></FORM><br>";