#1 2024-08-02 15:09:22

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
159

Clean install of 14.5 never completes

Greetings,

I am trying to do a clean install of 14.5.  I created a new /photos directory and uploaded the contents of the 14.5 zip file using FileZilla.  No errors.  I started the install and was told to set the file permissions of _data, to 777, which I did.  I restarted the install and it displayed the page requesting the database information, etc.  I filled that out and pressed the Start Installation button, but it never completes. Looking at the database, no tables have been created.

Does anyone have any ideas?

Operating system: FreeBSD
        PHP Version 8.2.20
        mysqlnd 8.2.20
        Graphics Library: External ImageMagick 7.1.1-14

Offline

 

#2 2024-08-02 22:48:45

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
159

Re: Clean install of 14.5 never completes

I enabled error reporting and found the following error:

Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in .../photos/install.php:29 which reads:

@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

set_magic_quotes_runtime was removed as of PHP 7.0.0.  I have no idea why they're not using mysql_real_escape_string, or how this runs for anyone.

So, I commented out that line, only to find that at line 34, it's calling:

if( !@get_magic_quotes_gpc() )

which was also removed from PHP, so I changed this to: if (false), as the code under that used slash functions that were also removed from PHP.

Then the code tries to use an undefined class (Template), which means that something is seriously wrong with the code, so I'm giving up. [Edit: Per my reading of the code, it should be defined, so this makes no sense.]

Is there someone from the development team who can explain what's going on here?

-- Geoff

Last edited by geoffschultz (2024-08-02 23:12:04)

Offline

 

#3 2024-08-03 01:23:20

erAck
Only trying to help
2015-09-06
2183

Re: Clean install of 14.5 never completes

There is no call to set_magic_quotes_runtime() in install.php, the only occurrence is at line 12 and commented out, see branch 14.x https://github.com/Piwigo/Piwigo/blob/a … ll.php#L12

In fact the call was removed in the year 2015 already for compatibility with PHP 7, see [Github] Piwigo commit ed8db3da

The call to get_magic_quotes_gpc() is on line 17 and not 34 and guarded by

if(function_exists('get_magic_quotes_gpc') && !@get_magic_quotes_gpc() )

See https://github.com/Piwigo/Piwigo/blob/a … ll.php#L17

Make sure you're actually installing 14.5 and not something else, like your ancient 2.4.3.


Running Piwigo at https://erack.net/gallery/

Offline

 

#4 2024-08-03 12:01:25

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
159

Re: Clean install of 14.5 never completes

The file that I unzipped was named piwigo-14.5.0.zip and came from this site.  When I run the install, the credentials window shows "14.5-0", so I believe that I have the right distribution.

However, when I compare the install.php in the zip file to the one on my server, they're different.  I edited the install.php on the server by right-clicking on it and view/edit on FileZilla, so I don't understand how they're different.  So, I'll delete the contents of /photo again, FTP the 14.5.0 zip file, and try again.

Last edited by geoffschultz (2024-08-03 12:03:41)

Offline

 

#5 2024-08-03 12:13:08

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
159

Re: Clean install of 14.5 never completes

Upon re-uploading the archive, and inserting the following lines at the top of the install.php file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

I got the following error:

Fatal error: Uncaught TypeError: fputs(): Argument #1 ($stream) must be of type resource, bool given in .../photos/install.php:336

And the code here is:

      $tmp_filename = md5(uniqid(time()));
      $fh = @fopen( PHPWG_ROOT_PATH.$conf['data_location'] . 'pwg_' . $tmp_filename, 'w' );
      @fputs($fh, $file_content, strlen($file_content));

I'm guessing that the fopen failed, returning false, and the "@" in front of fputs doesn't cover a bad parameter type

Offline

 

#6 2024-08-03 12:50:51

geoffschultz
Member
Marlborough, MA, USA
2012-07-01
159

Re: Clean install of 14.5 never completes

The following code, around line 315 in the install.php file, is incorrect.  The code under the first IF statement executes even if the fopen fails.  I changed it to

  $fp = @fopen( $config_file, 'w' );
  if (!($fp === false))

and it executes as expected.  However, the bottom 2 lines of the following need to be moved into the IF {}.

However, there's no error reporting if it can't write the config file!  With the above changes, the install completes, but with no config file, it just repeats trying to install.   

if ( !($fp = @fopen( $config_file, 'w' )))
    {
      // make sure nobody can list files of _data directory
      secure_directory(PHPWG_ROOT_PATH.$conf['data_location']);
     
      $tmp_filename = md5(uniqid(time()));
      $fh = @fopen( PHPWG_ROOT_PATH.$conf['data_location'] . 'pwg_' . $tmp_filename, 'w' );
        if (!($fh === false)) {
              @fputs($fh, $file_content, strlen($file_content));
              @fclose($fh);
        }

      $template->assign(
        array(
          'config_creation_failed' => true,
          'config_url' => 'install.php?dl='.$tmp_filename,
          'config_file_content' => $file_content,
          )
        );
    }
    @fputs($fp, $file_content, strlen($file_content));
    @fclose($fp);

Last edited by geoffschultz (2024-08-03 12:51:54)

Offline

 

#7 2024-08-03 13:38:11

OHappyDay
Member
2023-02-08
98

Re: Clean install of 14.5 never completes

Have you checked that the destination folder for the config file is writable to the install process? I guess you have but just to make sure this is not the root cause of the failure.

Offline

 

#8 2024-08-03 18:53:45

erAck
Only trying to help
2015-09-06
2183

Re: Clean install of 14.5 never completes

geoffschultz wrote:

when I compare the install.php in the zip file to the one on my server, they're different.  I edited the install.php on the server by right-clicking on it and view/edit on FileZilla, so I don't understand how they're different.

My guess: you did not do a clean install from scratch but had an existing 2.4.3 files tree there and your upload procedure failed to overwrite existing files (or failed to write files at all), hence you still had the 2.4.3 code.


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact