Problem with ./templates/...tpl files not being forund

Having problems installing EM? Let's fix that
Forum rules
DO NOT give out any FTP passwords to anyone! There is no reason to do so! If you need help badly enough, create a temporary FTP account that is restricted to only the files that you need help with and give the information for that. Giving out FTP information can be very dangerous!
Locked
StuartBall
Registered User
Posts: 9
Joined: Tue Feb 22, 2005 8:58 pm

Problem with ./templates/...tpl files not being forund

Post by StuartBall »

I am attempting to update from EM 0.0.10a to 0.1.13. I deleted the /admin/mods/ directory and all it contained and then uploaded the new version. Following this, the contents of /admin/mods/easymod is as follows:

Code: Select all

drwsrwx---    5 stuart59 8080          512 Feb 26 15ᛗ .
drwsrwx---    3 stuart59 8080          512 Feb 26 15ᛈ ..
-rw-rw----    1 stuart59 8080         6578 Feb 26 15ᛇ easymod.gif
-rw-rw----    1 stuart59 8080        32907 Feb 26 15ᛇ easymod_display_functions.php
-rw-rw----    1 stuart59 8080        63192 Feb 26 15ᛇ easymod_install.php
drwsrwx---    2 stuart59 8080          512 Feb 26 15ᛇ em_includes
drwsrwx---    2 stuart59 8080          512 Feb 26 15ᛇ includes
-rw-rw----    1 stuart59 8080        27710 Feb 26 15ᛇ lang_easymod.php
drwsrwx---    2 stuart59 8080         1024 Feb 26 15ᛊ templates
I run http://" target="_blank<mysite>/forum/admin/mods/easymod/easymod_install.php

The first page comes up OK showing Install Info (database:: mysql, phpBB version:: 2.0.12, Easymod version:: 0.1.13, Update EM from:: 0.0.10a) and with three options for my phpBB server (FTP - selected, Windows, no FTP). I leave the FTP option selected and click [submit] button.

Get "A required file [./templates/step1b_ftp.tpl] is missing. Aborting install."

I get similar errors if i click on "Advanced Mode" link (A required file [./templates/step1_classic.tpl] is missing. Aborting install.) or "Display Debug Info" link (A required file [./templates/display_debug.tpl] is missing. Aborting install.)

Theses files are present in /admin/mods/easymod/templates. Here is a listing of this directory:

Code: Select all

drwsrwx---    2 stuart59 8080         1024 Feb 26 15ᛊ .
drwsrwx---    5 stuart59 8080          512 Feb 26 15ᛠ ..
-rw-rw----    1 stuart59 8080         7262 Feb 26 15ᛊ WS_FTP.LOG
-rw-rw----    1 stuart59 8080         1484 Feb 26 15ᛊ display_debug.tpl
-rw-rw----    1 stuart59 8080          111 Feb 26 15ᛊ display_debug_footer.tpl
-rw-rw----    1 stuart59 8080          450 Feb 26 15ᛊ display_error.tpl
-rw-rw----    1 stuart59 8080          529 Feb 26 15ᛊ empw_settings.tpl
-rw-rw----    1 stuart59 8080          510 Feb 26 15ᛊ error.tpl
-rw-rw----    1 stuart59 8080         1820 Feb 26 15ᛊ file_access.tpl
-rw-rw----    1 stuart59 8080          160 Feb 26 15ᛊ form_settings.tpl
-rw-rw----    1 stuart59 8080         2449 Feb 26 15ᛊ ftp_settings.tpl
-rw-rw----    1 stuart59 8080          396 Feb 26 15ᛊ helpwin.tpl
-rw-rw----    1 stuart59 8080          630 Feb 26 15ᛊ hidden_access.tpl
-rw-rw----    1 stuart59 8080         1144 Feb 26 15ᛊ install_info.tpl
-rw-rw----    1 stuart59 8080        13542 Feb 26 15ᛊ nuttzy.jpg
-rw-rw----    1 stuart59 8080          158 Feb 26 15ᛊ page_footer.tpl
-rw-rw----    1 stuart59 8080          866 Feb 26 15ᛊ page_header.tpl
-rw-rw----    1 stuart59 8080         1541 Feb 26 15ᛊ page_start.tpl
-rw-rw----    1 stuart59 8080         2739 Feb 26 15ᛊ step1_classic.tpl
-rw-rw----    1 stuart59 8080         2010 Feb 26 15ᛊ step1_simple.tpl
-rw-rw----    1 stuart59 8080         1161 Feb 26 15ᛊ step1b_ftp.tpl
-rw-rw----    1 stuart59 8080         2063 Feb 26 15ᛊ step1b_nowrite_nocopy.tpl
-rw-rw----    1 stuart59 8080         1317 Feb 26 15ᛊ step1b_simple.tpl
-rw-rw----    1 stuart59 8080          949 Feb 26 15ᛊ step1b_write_copy.tpl
-rw-rw----    1 stuart59 8080         2350 Feb 26 15ᛊ step1b_write_nocopy.tpl
-rw-rw----    1 stuart59 8080         1496 Feb 26 15ᛊ step1c_empw.tpl
I have tried moving the templats directory to various positions and fiddled with access permissions (e.g. changing all files in mods directory to 744 and even 777), but to no effect. Anybody any idea what is going wrong?
Stuart

User avatar
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: Problem with ./templates/...tpl files not being forund

Post by A_Jelly_Doughnut »

EasyMOD should copy those template files during the install before this step...

Are you perhaps using a template other than subSilver?
A_Jelly_Doughnut

StuartBall
Registered User
Posts: 9
Joined: Tue Feb 22, 2005 8:58 pm

Re: Problem with ./templates/...tpl files not being forund

Post by StuartBall »

No, I am using SubSilver.

The line that is giving the error is in easymod_display_functions.php.

Code: Select all

function display_template( $template_file, $variables)
{
	// make sure the tpl file exists
	if (!file_exists( $template_file))
	{
		echo "<h1><span class="ok">A required file [$template_file] is missing.  Aborting install.</span></h1>\n" ;
		exit ;
	}
I have checked (by inserting echo getcwd()) that the default directory hasn't been changed from /admin/mods/easymod at this point. As you can see from the error messages quoted in my original post, it is looking for "./templates/step1b_ftp.tpl" - so it should be looking in /admin/mods/easymod/templates, not in <root>/templates/SubSilver as you suggest.

Stuart

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Problem with ./templates/...tpl files not being forund

Post by GPHemsley »

It doesn't appear documented where I keep all the listed bugs, but I do seem to remember running into this problem. The strange thing is, other people aren't having it. It must have to do with a difference between upgrading and installing. I'll check it out and get back to you.
Last edited by GPHemsley on Sun Feb 27, 2005 2:36 am, edited 1 time in total.

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Problem with ./templates/...tpl files not being forund

Post by GPHemsley »

Wait a second.... Your file permissions are not right, at least not as listed. Something is missed or set to 0 (indicated by the "---"). Double-check that 744 doesn't work, and repost the file structure and errors with the CHMOD settings again.

StuartBall
Registered User
Posts: 9
Joined: Tue Feb 22, 2005 8:58 pm

Re: Problem with ./templates/...tpl files not being forund

Post by StuartBall »

OK, I have done a CHMOD 777 on the lot, from /admin/mods downwards, so there should not be any access issues!

Listing for /admin/mods/easymod is now:

Code: Select all

drwxrwxrwx    5 stuart59 8080          512 Feb 27 11ᚿ .
drwxrwxrwx    3 stuart59 8080          512 Feb 26 15ᛈ ..
-rwxrwxrwx    1 stuart59 8080         6578 Feb 26 15ᛇ easymod.gif
-rwxrwxrwx    1 stuart59 8080        32907 Feb 26 19ᚿ easymod_display_functions.php
-rwxrwxrwx    1 stuart59 8080        63192 Feb 26 15ᛇ easymod_install.php
drwxrwxrwx    2 stuart59 8080          512 Feb 26 15ᛇ em_includes
drwxrwxrwx    2 stuart59 8080          512 Feb 26 15ᛇ includes
-rwxrwxrwx    1 stuart59 8080        27710 Feb 26 15ᛇ lang_easymod.php
drwxrwxrwx    2 stuart59 8080         1024 Feb 26 17ᚿ templates
and for /admin/mods/easymod/templates:

Code: Select all

drwxrwxrwx    2 stuart59 8080         1024 Feb 26 17ᚿ .
drwxrwxrwx    5 stuart59 8080          512 Feb 27 11ᚿ ..
-rwxrwxrwx    1 stuart59 8080         7262 Feb 26 15ᛊ WS_FTP.LOG
-rwxrwxrwx    1 stuart59 8080         1484 Feb 26 15ᛊ display_debug.tpl
-rwxrwxrwx    1 stuart59 8080          111 Feb 26 15ᛊ display_debug_footer.tpl
-rwxrwxrwx    1 stuart59 8080          450 Feb 26 15ᛊ display_error.tpl
-rwxrwxrwx    1 stuart59 8080          529 Feb 26 15ᛊ empw_settings.tpl
-rwxrwxrwx    1 stuart59 8080          510 Feb 26 15ᛊ error.tpl
-rwxrwxrwx    1 stuart59 8080         1820 Feb 26 15ᛊ file_access.tpl
-rwxrwxrwx    1 stuart59 8080          160 Feb 26 15ᛊ form_settings.tpl
-rwxrwxrwx    1 stuart59 8080         2449 Feb 26 15ᛊ ftp_settings.tpl
-rwxrwxrwx    1 stuart59 8080          396 Feb 26 15ᛊ helpwin.tpl
-rwxrwxrwx    1 stuart59 8080          630 Feb 26 15ᛊ hidden_access.tpl
-rwxrwxrwx    1 stuart59 8080         1144 Feb 26 15ᛊ install_info.tpl
-rwxrwxrwx    1 stuart59 8080        13542 Feb 26 15ᛊ nuttzy.jpg
-rwxrwxrwx    1 stuart59 8080          158 Feb 26 15ᛊ page_footer.tpl
-rwxrwxrwx    1 stuart59 8080          866 Feb 26 15ᛊ page_header.tpl
-rwxrwxrwx    1 stuart59 8080         1541 Feb 26 15ᛊ page_start.tpl
-rwxrwxrwx    1 stuart59 8080         2739 Feb 26 15ᛊ step1_classic.tpl
-rwxrwxrwx    1 stuart59 8080         2010 Feb 26 15ᛊ step1_simple.tpl
-rwxrwxrwx    1 stuart59 8080         1161 Feb 26 15ᛊ step1b_ftp.tpl
-rwxrwxrwx    1 stuart59 8080         2063 Feb 26 15ᛊ step1b_nowrite_nocopy.tpl
-rwxrwxrwx    1 stuart59 8080         1317 Feb 26 15ᛊ step1b_simple.tpl
-rwxrwxrwx    1 stuart59 8080          949 Feb 26 15ᛊ step1b_write_copy.tpl
-rwxrwxrwx    1 stuart59 8080         2350 Feb 26 15ᛊ step1b_write_nocopy.tpl
-rwxrwxrwx    1 stuart59 8080         1496 Feb 26 15ᛊ step1c_empw.tpl
The behaviour and error messages are unchanged from my original post.

Stuart

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Problem with ./templates/...tpl files not being forund

Post by GPHemsley »

Alright, this is very odd. Especially because the first step of the install requires a template and uses it just fine. It's time for some debugging.

OPEN:
easymod_display_functions.php

FIND:
easymod_display_functions.php, line 35 wrote:

Code: Select all

	if (!file_exists( $template_file))
	{
		echo "<h1><span class="ok">A required file [$template_file] is missing.  Aborting install.</span></h1>\n" ;
		exit ;
	}

REPLACE WITH:
easymod_display_functions.php, line 35 wrote:

Code: Select all

	if (!file_exists( $template_file))
	{
		echo "<h1><span class="ok">A required file [$template_file] is missing.  Aborting install.</span></h1>\n" ;

		// DEBUG INFO
		print phpversion() . "<br />\n";
		print getcwd() . "<br />\n";

		$dir = '.';
		$dh  = opendir( $dir );

		while( ( $filename = readdir( $dh ) ) !== FALSE )
		{
		   $files[] = $filename;
		}

		sort( $files );
		print_r( $files );
	}

FIND:
easymod_display_functions.php, line 231 wrote:

Code: Select all

	display_template( './templates/display_debug.tpl', $variables) ;
BEFORE, ADD:
easymod_display_functions.php, line 231 wrote:

Code: Select all

	// DEBUG INFO
	print_r( $variables );

And then let's see what happens.

StuartBall
Registered User
Posts: 9
Joined: Tue Feb 22, 2005 8:58 pm

Re: Problem with ./templates/...tpl files not being forund

Post by StuartBall »

OK, I made the changes you suggested to easymod_display_functions.php.

If I click the [Submit] button, it goes away and thinks about it for a bit, and then gives an error.

Code: Select all

A required file [./templates/step1b_ftp.tpl] is missing. Aborting install.
4.3.10

Fatal error&#58 Maximum execution time of 30 seconds exceeded in /pub/home/stuart59/htdocs/forum/admin/mods/easymod/easymod_display_functions.php on line 66
If I click the "Display Debug Info" link, I get the following:

Code: Select all

Debug Info&#58 The following information about your system config has been formatted for display in a forum post.  

Array ( [EM_File_Access] => [EM_no_problem] => [EM_read_access] => read access [EM_write_access] => write access [EM_root_write] => root path write [EM_chmod_access] => chmod access [EM_unlink_access] => unlink access [EM_mkdir_access] => mkdir access [EM_tmp_write] => tmp path write [EM_ftp_ext] => FTP extension [EM_safe_mode] => Safe Mode [EM_copy_access] => copy access [ACCESS_READ] => [b][color=green]OK[/b] [ACCESS_WRITE] => [b][color=green]OK[/b] [ACCESS_ROOT] => [b][color=green]OK[/b] [ACCESS_TMP] => [b]No[/b] [ACCESS_FTP] => [b][color=green]OK[/b] [ACCESS_SAFE] => [b][color=green]OFF[/b] [ACCESS_COPY] => [b][color=green]OK[/b] [ACCESS_CHMOD] => [b][color=green]OK[/b] [ACCESS_UNLINK] => [b][color=green]OK[/b] [ACCESS_MKDIR] => [b][color=green]OK[/b] [EM_debug_info] => Expanded Debug Info [EM_debug_format] => formatted for forum posting [EM_debug_installer] => EM installer [EM_phpBB_version] => phpBB version [EM_debug_work_dir] => Working Dir [EM_debug_step] => Install Step [EM_debug_mode] => Mode [EM_debug_the_error] => The Error [EM_debug_permissions] => Permissions [EM_debug_sys_errors] => including system errors [EM_debug_recommend] => Recommendations [EM_debug_write] => write [EM_debug_move] => move [EM_debug_selected] => Selected settings [EM_debug_ftp_dir] => ftp dir [EM_debug_ftp_host] => ftp host [EM_debug_ftp_debug] => ftp debug [EM_debug_ftp_ext] => ftp ext [EM_debug_ftp_cache] => ftp cache [EM_debug_listing] => CWD Listing [EM_VERSION] => 0.1.13 [PHPBB_VERSION] => 2.0.12 [CWD] => [STEP] => 1 [MODE] => debug [ERROR] => [color=green][b]No error.[/b][/color] [WRITE_REC] => server [MOVE_REC] => copy [WRITE_SEL] => [MOVE_SEL] => [FTP_DIR] => / [FTP_HOST] => localhost [FTP_DEBUG] => false [FTP_EXT] => fsock [FTP_CACHE] => false [FILE_LISTING] => ) 
A required file [./templates/display_debug.tpl] is missing. Aborting install.
4.3.10

Fatal error&#58 Maximum execution time of 30 seconds exceeded in /pub/home/stuart59/htdocs/forum/admin/mods/easymod/easymod_display_functions.php on line 67
The area where the error occurs in easymod_display_functions.php is:

Code: Select all

58  // look through the file, displaying each line to the screen
59  while (!feof( $template))
60  {
61      // get a line from the file
62      $line = fgets( $template, 4096) ;
63
64      // see if there is a template variable on this line
65      $prev_endpos = 0 ;
66      $pos = strpos( $line, '{{')+2 ;
67      $endpos = (strlen($line) > 2 ) ? strpos( $line, '}}', $pos)-1 &#58 $pos ;
Presumably, $template is empty because it hasn't been able to read the file, so it is looping forever.

Your code to print the current directory and its contents has not produced anything! That suggest to me getcwd() returns null.

As far as I can see, what it does before this point is to go through the various access checks. The debug info seems to suggest it has made these checks and they look to have been successful (apart from [ACCESS_TMP]). Could it be a side effect of one of these checks that is causing the problem?

Stuart

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Problem with ./templates/...tpl files not being forund

Post by GPHemsley »

Salvaged Debug Info wrote: [ACCESS_WRITE] => OK
[ACCESS_ROOT] => OK
[ACCESS_TMP] => No
[ACCESS_FTP] => OK
[ACCESS_SAFE] => OFF
[ACCESS_COPY] => OK
[ACCESS_CHMOD] => OK
[ACCESS_UNLINK] => OK
[ACCESS_MKDIR] => OK
[EM_VERSION] => 0.1.13
[PHPBB_VERSION] => 2.0.12
[CWD] =>
[STEP] => 1
[MODE] => debug
[ERROR] => No error.
[WRITE_REC] => server
[MOVE_REC] => copy
[WRITE_SEL] =>
[MOVE_SEL] =>
[FTP_DIR] => /
[FTP_HOST] => localhost
[FTP_DEBUG] => false
[FTP_EXT] => fsock
[FTP_CACHE] => false
[FILE_LISTING] =>
Looks like this does have to do with the the blank getcwd() results. There is a note in the EasyMOD file, as well as on PHP.net:
easymod_display_functions.php, Line 582 wrote:

Code: Select all

	// for some odd reason getcwd returns empty on some servers??? (added in 0.0.10a-2)
	if ($cwd == '')
	{
		// do nothing
	}
[url=http://www.php.net/getcwd] getcwd() Documentation[/url] wrote:Note: On some Unix variants, getcwd() will return FALSE if any one of the parent directories does not have the readable or search mode set, even if the current directory does. See chmod() for more information on modes and permissions.

User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Problem with ./templates/...tpl files not being forund

Post by GPHemsley »

Do me a favor: Put a file called phpinfo.php into the admin/mods/easymod/ directory with the contents of:

Code: Select all

<?php phpinfo(); ?>

Locked