textpattern / textpattern

A flexible, elegant, fast and easy-to-use content management system written in PHP.
https://textpattern.com
GNU General Public License v2.0
788 stars 112 forks source link

Multi-domain installation "Cannot redeclare find_relative_path" #1774

Closed freshmeat123 closed 10 months ago

freshmeat123 commented 2 years ago

Expected behaviour

Actual behaviour

When i try setup multi-domain setup accordingly official documentation i got this error:

$ curl https://admin-blog-1.mydomain.com/setup/index.php
<br />
<b>Fatal error</b>:  Cannot redeclare find_relative_path() (previously declared in /var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php:198) in <b>/var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php</b> on line <b>198</b><br />

When i run index.php from console i see that index.php run twice:

host:/var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup # php index.php
PHP Fatal error:  Cannot redeclare find_relative_path() (previously declared in /var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php:198) in /var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php on line 198

Fatal error: Cannot redeclare find_relative_path() (previously declared in /var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php:198) in /var/www/textpattern-4.8.8-beta.1/sites/blog1/admin/setup/index.php on line 198

Steps to reproduce

$ cd textpattern-4.8.8-beta.1
$ cp -r sites/site1 sites/blog1
$ php sites/blog1/admin/setup/index.php

Additional information

Textpattern version: 4.8.8-beta1 and 4.8.7 release

Web server vendor and version: nginx/php-fpm

Database server vendor and version: mysql80

PHP version: php8.0.13

Operating system: freebsd

petecooper commented 2 years ago

Paging @jools-r for any insight.

petecooper commented 2 years ago

@freshmeat123 - what happens if you access the setup routine from a browser instead of the command line?

freshmeat123 commented 2 years ago

Same error.

petecooper commented 2 years ago

I think this is perhaps due to 1 or more errors in the documentation / setup procedure because we've tested multi-site successfully and cannot yet reproduce your error. I'm going to do some more investigation over the next day or so, but it would definitely be worth checking in with the troubleshooting forum in the meantime.

jools-r commented 2 years ago

@freshmeat123: I didn't encounter that when trialling a new multisite setup, but to avoid the error can you try inserting the following at line 188 of /sites/site1/admin/setup/index.php

if (!function_exists('find_relative_path')) {

and then at the end of the same file add the closing brace after line 233:

}

That should stop any attempt to redeclare the function if it already exists.

Once you've done that, you can copy that file across to your other multisite sites.

petecooper commented 10 months ago

Closing for now due to age and no feedback - can be taken to the forum if required.