Eine Installation auf einem Server kann etwas schwierig werden, wenn man keinen Shell-Zugang hat.

Die Alternative die TYPO3-Archive vor dem FTP-Upload auszupacken ist zwar möglich aber recht (zeit)aufwändig.

 

Meist besteht aber die Möglichkeit innerhalb einer PHP-Datei Betriebssystem-Kommandos auszuführen. Daher bin ich auf folgende PHP-Datei für einen UNIX-Server gekommen:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <title>expand TYPO3</title>
    <style type="text/css">
    <!--
    /* ... Hier werden die Formate definiert ... */
    .navi { border:1px solid #333; position:fixed; bottom:0px; right:0px; background-color:#ddd; width:325px; font-family:sans-serif; padding:5px;}
    .navi .version-div { font-size:12px; }
    .navi .button { float:right; }
    .navi table { border-collapse:collapse; }
    .navi td { text-align:left; border:1px solid #ffffff; font-size:10px; padding-left:22px; text-indent:-22px; }
    .navi td input {  vertical-align: text-bottom; }
    .alert { background-color:orange; }
    #countdown { float:right;}
    form { margin:0; }
    -->
    </style>
    <script type="text/javascript">
        function countdown() {
            var countdowndiv = document.getElementById('countdown');
            var restzeit = parseInt(countdowndiv.firstChild.data);

            if (0 < restzeit) {
                restzeit--;
                if (restzeit == 30) {
                  var navidiv = document.getElementById('navi');
                  navidiv.className = 'navi alert';
                }
                countdowndiv.firstChild.data = ' '+restzeit;
                window.setTimeout('countdown()',1000);
            } else  {
                alert('['+restzeit+']')
            }
        }

        window.setTimeout('countdown()',1000);
    </script>


</head>
<body>
<?PHP
define('NL',"\n");
define('VERSIONCACHE', 'version.info');
define('ACCESS_FILE',    'ACCESS');
define('ACCESS_TIME',   600);

$content = '';

global $nextaction;
global $text;
global $versioninfo;

function do_exec($s) {
    echo '<span style="border:1px solid #cccccc">'.$s.'</span><br /><pre>';
    $output=shell_exec($s.' 2>&1;echo exitvalue=$?');
    //$output=shell_exec($s.';echo exitvalue=$?');

    $exitvaluepos = strpos($output,'exitvalue=');
    $exitvalue = intval(substr($output,$exitvaluepos+10));
    echo str_replace(array('<','>'),array('&lt;','&gt;'),$output);
    echo '</pre><hr />';
    return $exitvalue;
}
function err_msg($s) {
       return '<span style="color:white; background-color:red;">'.$s.'</span><br />';
}

function show_option($i,$s) {
       global $nextaction;
       return '<option value="'.$i.'"'.($i==$nextaction?' selected="selected"':'').'>'.$s.'</option>';
}

function checkAccess() {
    $retval = false;

    $directory = scandir('.');
    //echo '<h2>dir:</h2><pre>'.print_r($directory,true).'</pre>';
    if (count($directory) < 4) {
        $filewritten = file_put_contents(ACCESS_FILE,time());
        $retval = true;
    } else {
        $accessStat = stat(ACCESS_FILE);
        if (time() < $accessStat['mtime']+ACCESS_TIME) {
            $filewritten = file_put_contents(ACCESS_FILE,time());
            $retval = true;
        } else {
            //echo '<pre>'.print_r(array('filestat'=>$accessStat,'now'=>time(),'chk'=>$accessStat['mtime']+ACCESS_TIME),true).'</pre>';
        }
    }
    if ($filewritten === FALSE) {
        echo '<div class="alert">Access file '.ACCESS_FILE.' could not been written!</div>';
    }
    return $retval;
}

define('ACTION_TEST'                ,0);
define('ACTION_GETPACKAGE'          ,1);
define('ACTION_MD5PACKAGE'          ,2);
define('ACTION_EXTRACTPACKAGE'      ,3);
define('ACTION_MOVEPACKAGEUP'       ,4);

define('ACTION_LINKSOURCE'          ,10);
define('ACTION_LINKSOURCEUP'        ,11);

define('ACTION_REMOVE_TEMPFILES'    ,20);
define('ACTION_CHMOD'               ,21);
define('ACTION_INIT'                ,22);
define('ACTION_COPY_INDEXPHP'       ,23);

define('ACTION_ENABLEINSTALLTOOL'   ,30);

define('ACTION_REMOVE_PACKAGE'      ,40);
define('ACTION_REMOVE_ACCESS'       ,41);

define('ACTION_LS'                  ,100);
define('ACTION_INFO'                ,101);
define('ACTION_VERSIONINFO'         ,102);


$text[ACTION_TEST]              = 'test for writing';
$text[ACTION_GETPACKAGE]        = 'get selected package';
$text[ACTION_MD5PACKAGE]        = 'check MD5-Hash';
$text[ACTION_EXTRACTPACKAGE]    = 'extrakt selected package';
$text[ACTION_MOVEPACKAGEUP]     = 'move selected package into parentdir';

$text[ACTION_LINKSOURCE]        = 'build new link to source';
$text[ACTION_LINKSOURCEUP]      = 'build new link to source in parentdir';

$text[ACTION_REMOVE_TEMPFILES]  = 'remove ConfigurationCaches';
$text[ACTION_CHMOD]             = 'change file/dir-attributes to group-writable';
$text[ACTION_INIT]              = 'init some values';
$text[ACTION_COPY_INDEXPHP]     = 'copy index.php';

$text[ACTION_ENABLEINSTALLTOOL] = 'enable install-tool';

$text[ACTION_REMOVE_PACKAGE]    = 'remove this package';
$text[ACTION_REMOVE_ACCESS]     = 'remove Acess file';

$text[ACTION_LS]                = 'ls -al';
$text[ACTION_INFO]              = 'phpinfo';
$text[ACTION_VERSIONINFO]       = 'get available TYPO3 versions';

function show_radio($grpname,$i) {
       global $nextaction;
       global $text;
       $s = $text[$i];
       return '<label><input type="radio" name="'.$grpname.'" id='.$grpname.'_'.$i.'" value="'.$i.'"'.($i==$nextaction?' checked="checked"':'').' />'.$s.'</label>';
}

function get_version_infos() {
    global $versioninfo;
    if (!file_exists(VERSIONCACHE) || filemtime(VERSIONCACHE) < time()-60*60) {
        $json =  file_get_contents('http://get.typo3.org/json');
        file_put_contents(VERSIONCACHE,$json);
    } else {
        $json =  file_get_contents(VERSIONCACHE);
    }
    $versioninfo = json_decode($json,true);
}

function make_version_select($version) {
    global $versioninfo;

    if ($versioninfo) {
        $retval = '<select name="version">'.PHP_EOL;

        if (!$version) {
            $version = $versioninfo['latest_stable'];
        }
        foreach ($versioninfo as $key => $value) {
            if (is_array($value)) {
                $retval .= '  <optgroup label="'.$key.'">'.PHP_EOL;
                foreach ($value['releases'] as $subversion => $subvalues) {
                    if (is_array($subvalues)) {
                        $retval .= '    <option value="'.$subversion.'"'.($subversion==$version?' selected="selected"':'').'>'.$subversion.' ('.$subvalues['type'].')</option>'.PHP_EOL;
                    }
                }
                $retval .= '  </optgroup>'.PHP_EOL;
            } else {
                // latest_...
            }
        }

        $retval .= '</select>'.PHP_EOL;
    } else {
        // no versionsinfos available: make a normal input-field:
        $retval = '<input name="version" value="'.$version.'" />';
    }
    return $retval;
}

function make_package_select($version,$package) {
//  global $versioninfo;
//  $packageinfo = $versioninfo[substr($version,0,3)]['releases'][$version];

//  if ($versioninfo) {
        $retval  = '<select name="package">'.PHP_EOL;
        $retval .= '  <option value=""></option>'.PHP_EOL;
        $retval .= '  <option value="typo3_src"'          .($package=='typo3_src'          ?' selected="selected"':'').'>Source</option>'.PHP_EOL;
        $retval .= '  <option value="blankpackage"'       .($package=='blankpackage'       ?' selected="selected"':'').'>Blank Package</option>'.PHP_EOL;
        $retval .= '  <option value="dummy"'              .($package=='dummy'              ?' selected="selected"':'').'>Dummy</option>'.PHP_EOL;
        $retval .= '  <option value="introductionpackage"'.($package=='introductionpackage'?' selected="selected"':'').'>Introduction Package</option>'.PHP_EOL;
        $retval .= '  <option value="governmentpackage"'  .($package=='governmentpackage'  ?' selected="selected"':'').'>Government Package</option>'.PHP_EOL;
        $retval .= '</select>'.PHP_EOL;
//  } else {
//      $retval = 'please select a version first'.PHP_EOL;
//  }
    return $retval;
}

function get_package($version,$package) {
    if ($version && $package) {
        $fileExt = '.tar.gz';

        $filename = $package.'-'.$version.$fileExt;
        if (!file_exists($filename)) {
            $retval = do_exec('wget http://prdownloads.sourceforge.net/typo3/'.$filename);
            if ($retval == 8) {
                $retval = do_exec('wget http://dl1.typo3.org/TYPO3_'.$version.'/'.$filename);
                if ($retval == 8 && $package=='typo3_src') {
                    $retval = do_exec('wget http://get.typo3.org/'.$version.' -O '.$filename);
                }
            }
        } else {
            $retval .= $filename.' already available<br>'.NL;
        }
    }
    return $retval;
}



function showNavigation($current,$version,$package) {
    $retval = '<div class="navi" id="navi">'.NL
             .'<form method="POST">'.NL
             .'<div class="button"><input type="submit" value=" execute "/></div>'.NL
             .'<div class="version-div"><label for="version">Version: </label>'.make_version_select($version).'</div>'.NL
             .'<div id="countdown">'.ACCESS_TIME.'</div>'.NL
             .'<div class="version-div"><label for="package">Package: </label>'.make_package_select($version,$package).'</div>'.NL
             .'<table class="radioboxes">'.NL
             .'<tr>'
                 .'<td>'.show_radio('rad',ACTION_GETPACKAGE).'</td>'
                 .'<td>'.show_radio('rad',ACTION_MD5PACKAGE).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_EXTRACTPACKAGE).'</td>'
                 .'<td>'.show_radio('rad',ACTION_MOVEPACKAGEUP).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_LINKSOURCE).'</td>'
                 .'<td>'.show_radio('rad',ACTION_LINKSOURCEUP).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_REMOVE_TEMPFILES).'</td>'
                 .'<td>'.'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_CHMOD).'</td>'
                 .'<td>'.show_radio('rad',ACTION_INIT).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_ENABLEINSTALLTOOL).'</td>'
                 .'<td>'.show_radio('rad',ACTION_COPY_INDEXPHP).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_REMOVE_PACKAGE).'</td>'
                 .'<td>'.show_radio('rad',ACTION_REMOVE_ACCESS).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_VERSIONINFO).'</td>'
                 .'<td>'.show_radio('rad',ACTION_INFO).'</td>'
             .'</tr>'.NL.'<tr>'
                 .'<td>'.show_radio('rad',ACTION_LS).'</td>'
                 .'<td>'.show_radio('rad',ACTION_TEST).'</td>'
             .'</tr>'.NL.'</table>'.NL
             . '</form>'.NL
             . '</div>'.NL
             ;
    return $retval;
}

if (!checkAccess()) {
    die('you are not allowed to access!');
}

get_version_infos();

$action = intval($_POST['rad']);
$package = $_POST['package'];
$version_a = explode('.',$_POST['version']);

$version = intval($version_a[0]).'.'.intval($version_a[1]).'.'.$version_a[2];

if ($version == '0.0.') {
    $content .= 'please insert a (valid) TYPO3-version<br>';
}

$nextaction = $action;

switch ($action) {
    case ACTION_GETPACKAGE:
        if ($package) {
            $content .= get_package($version,$package);
            $nextaction = ACTION_MD5PACKAGE;
        } else {
            $content .= 'please select a package first';
        }
        break;

    case ACTION_MD5PACKAGE:
        // display md5-hashes for check on correct archives
        $content .= err_msg('compare to <a href="http://wiki.typo3.org/index.php/TYPO3_'.$version.'#MD5_checksums">correct md5-values</a>');
        if ($package=='typo3_src') {
            $packageinfo = $versioninfo[substr($version,0,3)]['releases'][$version];
            $content .= '<br />MD5: '.$packageinfo['checksums']['tar']['md5'];
        }

        do_exec('md5sum *.gz');
        $nextaction = ACTION_EXTRACTPACKAGE;
        break;

    case ACTION_EXTRACTPACKAGE:
        // extract package
        if ($package) {
            do_exec('tar -zxvf '.$package.'-'.$version.'.tar.gz');
            $nextaction = ACTION_LINKSOURCE;
        } else {
            $content .= 'please select a package first';
        }
        break;

    case ACTION_MOVEPACKAGEUP:
        if ($package) {
            if ($package == 'typo3_src') {
                do_exec('mv typo3_src-'.$version.' ..');
                $nextaction = ACTION_LINKSOURCEUP;
            } else {
                // get content from subdir into current dir
                do_exec('mv '.$package.'-'.$version.'/* .');
                // remove empty directory
                do_exec('rmdir '.$package.'-'.$version);
                $nextaction = ACTION_LINKSOURCE;
            }
        } else {
            $content .= 'please select a package first';
        }
        break;

    case ACTION_LINKSOURCE:
        // make new symlink for sources
        do_exec('rm typo3_src');
        do_exec('ln -s typo3_src-'.$version.' typo3_src');

        if (is_dir('t3lib')) {
        	do_exec('rmdir t3lib');
        	do_exec('mv t3lib t3lib_old');
		}
		if (  (intval($version_a[0]) < 6)
		    ||((intval($version_a[0]) == 6) && (intval($version_a[1]) < 2 ))
		   ) {
        	do_exec('ln -s typo3_src/t3lib t3lib');
        }
		if (  (intval($version_a[0]) > 6)
		    ||((intval($version_a[0]) == 6) && (intval($version_a[1]) > 1 ))
		   ) {
		   	do_exec('ln -s typo3_src/index.php index.php');
		}
        do_exec('rmdir typo3');
        do_exec('mv typo3 typo3_old');
        do_exec('ln -s typo3_src/typo3 typo3');

        $nextaction = ACTION_REMOVE_TEMPFILES;
        break;
    case ACTION_LINKSOURCEUP:
        // make new symlink for sources
        do_exec('rm typo3_src');
        do_exec('ln -s ../typo3_src-'.$version.' typo3_src');


        if (is_dir('t3lib')) {
        	do_exec('rmdir t3lib');
        	do_exec('mv t3lib t3lib_old');
		}
		if (  (intval($version_a[0]) < 6)
		    ||((intval($version_a[0]) == 6) && (intval($version_a[1]) < 2 ))
		   ) {
        	do_exec('ln -s typo3_src/t3lib t3lib');
        }
		if (  (intval($version_a[0]) > 6)
		    ||((intval($version_a[0]) == 6) && (intval($version_a[1]) > 1 ))
		   ) {
		   	do_exec('ln -s typo3_src/index.php index.php');
		}
        do_exec('rmdir typo3');
        do_exec('mv typo3 typo3_old');
        do_exec('ln -s typo3_src/typo3 typo3');

        $nextaction = ACTION_REMOVE_TEMPFILES;
        break;

    case ACTION_REMOVE_TEMPFILES:
        do_Exec('rm typoconf/temp*');
        do_Exec('rm -r typo3temp/Cache/*');
        $nextaction = ACTION_CHMOD;
        break;

    case ACTION_CHMOD:
        // change access-rights ...
        // .. for all directories
        //$content .= err_msg('directoryCreateMask im InstallTool setzen!');
        do_exec('find . -type d -exec chmod 775 \'{}\' \;');
        // .. for all files
        //$content .= err_msg('fileCreateMask im InstallTool setzen!');
        do_exec('find . -type f -exec chmod 664 \'{}\' \;');

        // enhance localconf.php for appropriate values:
        if (file_exists('typo3conf/localconf.php')) {
            $localconffile = file_get_contents('typo3conf/localconf.php');

            $localconffile = str_replace('?'.'>','$TYPO3_CONF_VARS[\'BE\'][\'fileCreateMask\'] = \'664\';'.NL
                    .'$TYPO3_CONF_VARS[\'BE\'][\'folderCreateMask\'] = \'775\';'.NL
                    .'?'.'>',$localconffile);

            file_put_contents('typo3conf/localconf.php', $localconffile);
        }
        $nextaction = ACTION_ENABLEINSTALLTOOL;
        break;

    case ACTION_INIT:
        if (file_exists('typo3conf/localconf.php')) {
            $localconffile = file_get_contents('typo3conf/localconf.php');

            $localconffile = str_replace('?'.'>','$TYPO3_CONF_VARS[\'SYS\'][\'UTF8filesystem\'] = \'1\';'.NL
                    .(intval($version_a[0])==4 && intval($version_a[1])<5 ? '$TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\'] = \'set names utf8\';'.NL
                            .'$TYPO3_CONF_VARS[\'BE\'][\'forceCharset\'] = \'utf-8\';'.NL
                            : '')
                    .'$TYPO3_CONF_VARS[\'GFX\'][\'TTFdpi\'] = \'96\';'.NL
                    .'$TYPO3_CONF_VARS[\'SYS\'][\'t3lib_cs_convMethod\'] = \'mbstring\';'.NL
                    .'?'.'>',$localconffile);

            file_put_contents('typo3conf/localconf.php', $localconffile);
        }
        $nextaction = ACTION_ENABLEINSTALLTOOL;
        break;

    case ACTION_COPY_INDEXPHP:
        do_exec('rm index.php');
        do_exec('cp typo3_src/index.php index.php');
        do_exec('ls -la');
        $nextaction = ACTION_LS;
        break;

    case ACTION_ENABLEINSTALLTOOL:
    	if (is_dir('typo3conf')) {
	        // next step will be to use install-tool: so grant access:
	        do_exec('touch typo3conf/ENABLE_INSTALL_TOOL');

	        // show links to install-tool and 1-2-3-Install
	        $content .= '<a href="typo3/install/index.php" target="install">Install-Tool</a><br>';
	        $content .= '<a href="typo3/install/index.php?mode=123&step=1&password=joh316" target="install">1-2-3-Install</a>';
		} else {
			// assume > 6.2
			// enable install-wizard:
			do_exec('touch INSTALL');
			$content .= '<a href="index.php" target="install">Install-Wizard</a><br>';
		}
        break;

    case ACTION_REMOVE_PACKAGE:
        do_exec('rm '.$package.'-'.$version.'.tar.gz');
        $nextaction = ACTION_REMOVE_ACCESS;
        break;

    case ACTION_REMOVE_ACCESS:
        do_exec('rm ACCESS');
        $nextaction = ACTION_LS;
        break;

    case ACTION_LS:
        do_exec('ls -la');
        $nextaction = ACTION_LS;
        break;
    case ACTION_INFO:
        phpinfo();
        $nextaction = ACTION_LS;
        break;
    case ACTION_VERSIONINFO:
        $json =  file_get_contents('http://get.typo3.org/json');
        file_put_contents(VERSIONCACHE,$json);

        $versioninfo = json_decode($json,true);
        $content .= '<pre>'.print_r($versioninfo,true).'</pre>';
        $nextaction = ACTION_LS;
        break;

    case ACTION_TEST:
    default:
        // check for correct permissions. try to create a testfile.
        do_exec('echo test > testfile');
        if (!file_exists('testfile')) {
            echo err_msg('can\'t create file in current directory<br>missing permissions?');
            // show user data
            do_exec('id');
            // show rights of current directory
            do_exec('ls -la');
            $nextaction = ACTION_TEST;
        } else {
            // remove testfile
            do_exec('rm testfile');
            $content .= 'writing possible, please proceed<br>';
            $nextaction = ACTION_GETPACKAGE;
        }
        break;


}

$content .= showNavigation($nextaction,$version,$package);

echo '<hr>'.$content;

?>

</body>
</html>

Für eine TYPO3-Installation muss man nur diese PHP-Datei (zb. als unpack.php) auf den Server kopieren. Dann ruft man diese PHP-Datei auf (z.B. www.meinedomain.tld/unpack.php), die zuerst die Schreibrechte überprüft, dann die beiden Archive holt und anschließend auspackt. Und damit man mit der Konfiguration direkt loslegen kann gibt es am Ende der PHP-Datei einen direkten Link zum Install-Tool und zum 1-2-3-Install.

 
Ihre aktuelle Seitenauswahl:  
>>>