elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.42k stars 266 forks source link

Fatal error during activation of wp2static plugin - Class 'WP2Static\Controller' not found #629

Closed aerno closed 4 years ago

aerno commented 4 years ago

I am trying to get the latest WP2Static plugin to work, but to no avail. Anyone here who can assist ?

Been searching the web for "php Controller" class but can only find things about Model View Controllers.

I am on Apache 2.4.46 & PHP 7.2.33 at the moment


Wordpress gives me this error when trying to activate the plugin:

Plugin could not be activated because it triggered a fatal error.

Fatal error: Uncaught Error: Class 'WP2Static\Controller' not found in /volumes/www/wordpress/wp-content/plugins/wp2static/wp2static.php:24 Stack trace: #0 /volumes/www/wordpress/wp-admin/includes/plugin.php(2297): include() #1 /volumes/www/wordpress/wp-admin/plugins.php(191): plugin_sandbox_scrape('wp2static/wp2st...') #2 {main} thrown in /volumes/www/wordpress/wp-content/plugins/wp2static/wp2static.php on line 24

aerno commented 4 years ago

GitHub gave me an error posting my Issue, hence it is double posted.

john-shaffer commented 4 years ago

Try running composer install from the wp2static directory (/volumes/www/wordpress/wp-content/plugins/wp2static/).

aerno commented 4 years ago

@john-shaffer Thanx! I will try that tomorrow and see how it goes.

I didn't find any "install.txt" or what have we, only a forward to your website, so I was just starting the application with my fingers crossed ;-)

I will update this ticket in Github with my results tomorrow.

aerno commented 4 years ago

Trying to install composer, but wow this is complicated I think.

Simply running 'composer install' doesn't do the trick: "bash: composer: command not found..."

I am assuming, based on research inside the the file 'composer.lock' inside the WB2Static directory, that I need to follow these instructions:

https://getcomposer.org/doc/00-intro.md

Am I correct ?

As my webserver is running inside a chroot, without any user actually being able to get a shell inside the chroot, ofcourse having the PHP setting open_basedir enabled for extra security, adding these kind of PHP extra package managers isn't easy.

I am currently rebuilding my chroot having support for shell and su enabled, so I can run the downloaded composer.phar file inside the chroot, which hopefully adds the extra files needed for wp2static inside its directory.

Wow what is software getting complex nowadays. Where are the times you just downloaded a binary and it worked (or it didn't) ?

john-shaffer commented 4 years ago

https://getcomposer.org/doc/00-intro.md

Am I correct ?

Yes, that or use your distro's package manager.

You don't have to do that on your web server, though. Running composer install on any machine and zipping up the output will give you a working plugin. This is the zip for the latest commit a314548b30daf5b99d37d47f2073284c315ebd0c: wp2static.zip

There should be more regular releases of zips once v7 is in release state, but it's still in alpha and development is pretty fluid.

aerno commented 4 years ago

I managed to run the 'composer install' inside of my chroot webserver setup:

bash$ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 28 installs, 0 updates, 0 removals As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension. This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost. Installing 'unzip' may remediate them.

It keeps on complaining about 'manifest', even after a 2nd run (why do ICT people believe running something twice yields a different result ?), but the plugin now seems to work fine.

The plugin seems mostly happy about my setup, and as I installed PHP 7.2 only for a test, instead of the latest version 7.4, it will soon be in production with 7.4.

@john-shaffer: After having used a modified version of your old Wordpress Static Output Plugin for about 8 years I am impressed to see how much progress the plugin has made. Thanks for all the hard work !

In the old setup I programmed my own shell based rewriting system (publish.sh) to rewrite all the URLs inside of the static output tree and now that is included inside the plugin.

I made the publish script (being run from crontab every 5 minutes) checking if the index.html of the Static output plugin's directory was newer than that of the production website and if so publish the new site to the production website.

Thanks, Arno

john-shaffer commented 4 years ago

@john-shaffer: After having used a modified version of your old Wordpress Static Output Plugin for about 8 years I am impressed to see how much progress the plugin has made. Thanks for all the hard work !

That's 99% @leonstafford's work. I just do a little work on WP2Static v7 and the S3 addon.

Glad to see that you got it working.

leonstafford commented 4 years ago

@aerno great stuff! It shouldn't be this complicated (I take credit for the bad UX!), but glad to see you powering through it!

@john-shaffer is too humble - he's brought a lot of programming expertise and energy to the plugin this year. I have short periods where I get 80% of what I want done, then spend a year on the remaining 20% :P

aerno commented 4 years ago

Thanks John & Leon.

gokulzat commented 4 months ago

I have been encountering fatal errors when trying to download and install the Wp2static plugin. Could you please send me the wp2static plugin zip file from GitHub?