[SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Ask for help or provide support to other members.
daddymadu
Posts: 7
Joined: Sun Jan 09, 2022 2:52 am

[SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by daddymadu »

dear community
good day!
i just installed WonderCMS 3.2.0 in my server and it looks fantastic!
i use the default theme and just installed
additionals-contents, hits-counter, simple-blog, simple-statistics, Cache thumbs, summernote-editor but i cant edit post in blog
i removed simple-statistics and tried again and no luck
i removed and reinstalled simple-blog again and same issue wont edit default post nor newly created one!
i can delete default and created posts.
no error in chrome console nether
i would be grateful if any one helped me here
here's the error message i received below from nginx 1.21.5 error log using php8.1-fpm running ubuntu 21.10


and simple blog is accepting new posts title only

Code: Select all

2022/01/10 17:33:13 [error] 4710#4710: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "menu" in /*/nginx/html/index.php on line 1984" while reading response header from upstream, client: *, server: *, request: "POST /blog/hello-world HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "*", referrer: "*/blog/hello-world"
php8.1-xml is a MUST for SimpleStatistics to not break you main website so you don't have to use ftp to remove the plugin manually as your admin backend won't be accessible (possible bug report)

even though after i got simple blog to only post default blog post but cant edit the content of any post i can't say the same for SimpleStatistics
it still showing error

Code: Select all

2022/01/10 17:30:21 [error] 4710#4710: *31 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Attempt to assign property "contact-us" on null in /*/nginx/html/plugins/simple-statistics/class.SimpleStatistics.php:72
Stack trace:
#0 /*/nginx/html/plugins/simple-statistics/class.SimpleStatistics.php(122): SimpleStatistics->set()
#1 /*/nginx/html/index.php(1109): SimpleStatistics->collectData()
#2 /*/nginx/html/index.php(1484): Wcms->hook()
#3 /*/nginx/html/themes/sky/theme.php(81): Wcms->js()
#4 /*/nginx/html/index.php(1519): require_once('...')
#5 /*/nginx/html/index.php(182): Wcms->loadThemeAndFunctions()
#6 /*/nginx/html/index.php(16): Wcms->render()
#7 {main}
  thrown in /*/nginx/html/plugins/simple-statistics/class.SimpleStatistics.php on line 72" while reading upstream, client: *, server: *, request: "GET /contact-us/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "*", referrer: "https://*/home/"
las thing i saw in latest update change log Option to have a template for each page
but in doc/wiki i can't find any example for how to do so, can you please guide me through?

another issue i need help with, if i set

Code: Select all

fastcgi_intercept_errors on;
to intercept error pages and add my own custom
i can't access login page and it renders 404
but the rest of the site is working fine though
is there's any way around that so i can access admin URL and keep intercepting error pages to show my own customs?

update:
fastcgi_intercept_errors on;
i found a work around but i don't know the impleficiation of it, so please guide me
let's say my login url is

Code: Select all

example.com/fhgsdk34587sdnfklsadgv34-325wdfas
i logged in as admin
changed login url to

Code: Select all

fhgsdk34587sdnfklsadgv34-325wdfas-1
and created a page with this name

Code: Select all

fhgsdk34587sdnfklsadgv34-325wdfas 
and edit it and put the following code from wcms login page

Code: Select all

<style>.showUpdate{display: block !important}</style>
				<div class="wUpdate" style="display:none;color:#ccc;left:0;top:0;width:100%;height:100%;position:fixed;text-align:center;padding-top:100px;background:rgba(51,51,51,.8);z-index:2448"><h2>Logging in and checking for updates</h2><p>This might take a minute, updates are checked once per week.</p></div>
				<form action="https://example.com/fhgsdk34587sdnfklsadgv34-325wdfas" method="post">
					<div class="winput-group text-center">
						<h1>Login to your website</h1>
						<input type="password" class="wform-control" id="password" name="password" placeholder="Password" autofocus="" data-enpassusermodified="yes"><br><br>
						<span class="winput-group-btn">
							<button type="submit" class="wbtn wbtn-info" onclick="document.getElementsByClassName('wUpdate')[0].classList.toggle('showUpdate'); localStorage.clear();">Login</button>
						</span>
					</div>
				</form>
them i downloaded database.js
edited it and re instated login url to

Code: Select all

fhgsdk34587sdnfklsadgv34-325wdfas
from

Code: Select all

fhgsdk34587sdnfklsadgv34-325wdfas-1
then i edited my nginx file and enabled error intercept on
an viola now i can login by url and redirect all errors to my custom error pages
but each time i need to change login url i will had to do it via database and change it in two locations (security section and pages section) it's not a big deal
but i feel wondercms should have defined login page as hidden page with it's own slug each time we change login url so it has a hard location or maybe something else idk. feel free to enlighten me.
maybe we can have middle ground here as i know you made it that way so search engine and bot's won't detect it but we already have hidden page with long random slug not linked in any part in site.


thank you!
best regards,
User avatar
wiz
Posts: 757
Joined: Sat Oct 30, 2010 12:23 am

Re: hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by wiz »

Hello daddymadu.

1.We have identified the issue in Simple Blog and have updated it.
- Please log in to your WonderCMS website and update the Simple Blog plugin.
- Your issues should be resolved and it editing should work as expected.

2. It seems you are having issues with clean URL's, did you make sure to update your nginx.conf to support this?
- https://github.com/robiso/wondercms/wik ... ver-config

It's not exactly clear what's wrong with Simple Statistics for you? Are you saying additional packages must be downloaded for PHP to make it work? Please clarify so it will be easier to help you out.

3. To have a custom page template, in your current theme, for example in your themes/customTheme folder, you can create a file home.php with a different page template.
- To make it easier, you can copy the theme.php file, rename it to home.php and replace the styles you want to see on your home page.
- The above example will only afftect the page "home".

We'll add this to our GitHub documentation to make it easier for everyone to create custom page templates. Edit: added basic documentation here: https://github.com/robiso/wondercms/wik ... e-template
daddymadu
Posts: 7
Joined: Sun Jan 09, 2022 2:52 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by daddymadu »

hello wiz,

glad to have you here, first thank you for your replay
and second thank you again for fixing blog bug and updating wiki regarding custom template.

regarding login page
maybe i couldn't explain well enough
my nginx config is done correctly as i followed wcms nginx config guide
and for default wcms installation settings there's no issue at all
but if we want to detch wcms error page system and use our own nginx custom error pages instead
in nginx config we have to use
fastcgi_intercept_errors on;
inside location ~ \.php(/|$)
and now nginx can intercept all error pages and show our custom one instead of wcms /404 page
the problem is when we do that we cannot access login page as it's not hard defined as page in wcms but site works normally
to overcome such issue i have to create a hidden page with the same login url in wcms
and in that hidden page i added the following wcms default login code

Code: Select all

<style>.showUpdate{display: block !important}</style>
				<div class="wUpdate" style="display:none;color:#ccc;left:0;top:0;width:100%;height:100%;position:fixed;text-align:center;padding-top:100px;background:rgba(51,51,51,.8);z-index:2448"><h2>Logging in and checking for updates</h2><p>This might take a minute, updates are checked once per week.</p></div>
				<form action="https://example.com/fhgsdk34587sdnfklsadgv34-325wdfas" method="post">
					<div class="winput-group text-center">
						<h1>Login to your website</h1>
						<input type="password" class="wform-control" id="password" name="password" placeholder="Password" autofocus="" data-enpassusermodified="yes"><br><br>
						<span class="winput-group-btn">
							<button type="submit" class="wbtn wbtn-info" onclick="document.getElementsByClassName('wUpdate')[0].classList.toggle('showUpdate'); localStorage.clear();">Login</button>
						</span>
					</div>
				</form>
so i can login as normal again
this is only applicable if i want to retain my own custom page and served by nginx instead of wcms and retain access to admin login url.

so i suggest to make admin login page defined in pages section but hidden and when we change login url from admin panel it changes the page slug to match that change that way we can decide either to use nginx custom error page or wecms without issue.

hope i explained it enough, english is not my native though. this is not rushed and it's not critical.



only one problem left with simple-statistics plugin
yes it's requires php-xml extension to be installed and frankly it should be installed for any thing that requires dom extension, kindly update the WCMS wiki to reflect it in requirements

but even when installed

i still receive the following error in nginx error log

Code: Select all

[error] 72097#72097: *4026 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Attempt to assign property "home" on null in /nginx/html/plugins/simple-statistics/class.SimpleStatistics.php:72
Stack trace:
#0 /nginx/html/plugins/simple-statistics/class.SimpleStatistics.php(122): SimpleStatistics->set()
#1 /nginx/html/index.php(1109): SimpleStatistics->collectData()
#2 /nginx/html/index.php(1484): Wcms->hook()
#3 /nginx/html/themes/sky/theme.php(81): Wcms->js()
#4 /nginx/html/index.php(1519): require_once('...')
#5 /nginx/html/index.php(182): Wcms->loadThemeAndFunctions()
#6 /nginx/html/index.php(16): Wcms->render()
#7 {main}
  thrown in /nginx/html/plugins/simple-statistics/class.SimpleStatistics.php on line 72" while reading upstream, client: *, server: *, request: "GET /home/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "*", referrer: "https://*/blog"
simple-statistics plugin is correctly installed put it's not logging any statistics

i'd like to thank you guys for such an amazing platform that fit's my needs perfectly and simple enough to make me focus on my own live instead of chasing errors, plugins, themes etc i even inspired by your own main web page and i made mine to feel the same.

i've sent you a cup of coffee hope you enjoyed it
User avatar
wiz
Posts: 757
Joined: Sat Oct 30, 2010 12:23 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by wiz »

Hello daddymadu,
glad to have you here, first thank you for your replay
and second thank you again for fixing blog bug and updating wiki regarding custom template.
most welcome!
the problem is when we do that we cannot access login page as it's not hard defined as page in wcms but site works normally
I understand why you're running into these issues now. The reason is, we specifically return a 404 status for the login page as a safety measure for Search Engines and bots not to find or cache that page, as it should be completely private.

A solution would be:
- handle all other errors except for the 404 pages in your NGINX.

I would rather suggest one of these solutions:
- while you are logged into your WonderCMS website, you can visit yourdomain.com/404, and edit the page there directly
or even better,
- you can create a 404.php page in your theme, and you can create a completely customizable 404 page there, while still having your login URL working as expected.

Regarding the Simple Statistics:
- SimpleXML (php-xml) should be already enabled by default on PHP installations, this is why we don't list these extensions that are bundled with PHP installations, otherwise the list of extensions would be longer.

I'm currently concerned you are missing more PHP extensions and that could be the reason why your simple statistics is not working.
1. Did you set up the PHP yourself?
2. Is DOM/XML also enabled in your php.ini?
3. Is there any chance you can test this out on another host with pre-configured PHP?
4. Can you try creating a clean install of WonderCMS in a separate folder with just the Simple Statistics plugin, and let us know if it then works (without any other plugins)?


Last but not least, thank you for your support and donation.
As a token of appreciation, we would like to add your name/last name and website to our official list of donors: https://www.wondercms.com/donors

Can you please send post that information, so we can add you? (this is optional if you're worried about your personal information).
daddymadu
Posts: 7
Joined: Sun Jan 09, 2022 2:52 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by daddymadu »

hello wiz,
- while you are logged into your WonderCMS website, you can visit yourdomain.com/404, and edit the page there directly
or even better,
- you can create a 404.php page in your theme, and you can create a completely customizable 404 page there, while still having your login URL working as expected.
Great i didn't think about that, i will give it a try, thank you!
- SimpleXML (php-xml) should be already enabled by default on PHP installations
that's true if i use apache, but if i gonna use nginx i have to nuke php installation and go with php-fpm install via the following

Code: Select all

sudo apt install php8.1 php8.1-common php8.1-cli php8.1-fpm php8.1-mbstring php8.1-zip php8.1-curl php8.1-xml php8.1-gd php8.1-xsl php8.1-sqlite3 php8.1-pspell php8.1-json php8.1-xmlrpc php8.1-cgi php8.1-bz2 php8.1-mcrypt php8.1-pear php8.1-apcu php8.1-yaml

1. Did you set up the PHP yourself?
2. Is DOM/XML also enabled in your php.ini?
3. Is there any chance you can test this out on another host with pre-configured PHP?
4. Can you try creating a clean install of WonderCMS in a separate folder with just the Simple Statistics plugin, and let us know if it then works (without any other plugins)?
1- yes i installed the php myself i even tried 7.4 / 8.0 and now i'm on 8.1
2- yes i checked php info and all extensions mentioned in installation command above are installed and enabled (i can share php info output privately if you like) kindly note that DOM cannot be installed as it's already included in php8.1-xml.
3- i will search for another host to try this one out
4- yes i tried on sub folder but i couldn't login to admin dashboard it kept showing 404
then i backed my main site up and removed the whole thing and tried a clean wcms install and only installed Simple Statistics plugin and the same error in nginx log appeared and Simple Statistics plugin tab isn't showing any info.
Last but not least, thank you for your support and donation.
As a token of appreciation, we would like to add your name/last name and website to our official list of donors: https://www.wondercms.com/donors
oh, thank you! (Mohamad Hegazy / https://daddymadu.gg)

again thank you for your replay/time and i'm sorry for such a headache, i tried to activate that plugin on wondercms demo site but i couldn't as it's not allowed in demo site.

again i can't thank you enough.

best regards,
User avatar
wiz
Posts: 757
Joined: Sat Oct 30, 2010 12:23 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by wiz »

On the demo, we have to turn off most features for security reasons.

I would be interesting to see if this is an NGINX only issue (I don't have much experience there unfortunately).

Let us know when you try, interested to see the results. I've re-tested this and Simple Statistics work as expected on PHP 7.4 and Apache.

You have now been added to: https://www.wondercms.com/donors, also nice website you have!

Yes i tried on sub folder but i couldn't login to admin dashboard it kept showing 404
- Maybe the nginx.conf has to be also configured for WonderCMS to also work in subfolders?
daddymadu
Posts: 7
Joined: Sun Jan 09, 2022 2:52 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by daddymadu »

dear wiz,
good day!
wiz wrote: Sun Jan 16, 2022 3:17 pm On the demo, we have to turn off most features for security reasons.

I would be interesting to see if this is an NGINX only issue (I don't have much experience there unfortunately).

Let us know when you try, interested to see the results. I've re-tested this and Simple Statistics work as expected on PHP 7.4 and Apache.

You have now been added to: https://www.wondercms.com/donors, also nice website you have!

Yes i tried on sub folder but i couldn't login to admin dashboard it kept showing 404
- Maybe the nginx.conf has to be also configured for WonderCMS to also work in subfolders?
sorry for late replay as i tried to investigate this problem till the end
1- thank you for adding my name!
2- WCMS on sub folder i will try to play a little bit with nginx config to make it work with subfolders and let you know for sure.
also nice website you have!
it wasn't gonna happen without WonderCMS, thank you!

3- your doubts regarding Simple Statistics plugin being an nginx only issue is correct!

here's my conclusion down below:

first i was having unlimited lifetime hosting plan from long time ago it's serving lightspeed with apache server so i pointed an old domain to it
https://mtmreviews.co.technology/
installed WCMS and Simple Statistics plugin only and it worked smoothly as expected
so now i suspected my nginx instance
so to roll that out
i got 1$ domain https://daddymadu.xyz
and pointed it to another vps hosting 30 days for free basically running ubuntu 20.04
i installed php with all required extensions and certbot to activate ssl then i edited nginx config and add only WCMS required configs every thing else is default
installed WCMS and Simple Statistics plugin only and the problem showed here

Code: Select all

[error] 1751#1751: *42 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Attempt to assign property "home" on null in /var/www/html/plugins/simple-statistics/class.SimpleStatistics.php:72
Stack trace:
#0 /var/www/html/plugins/simple-statistics/class.SimpleStatistics.php(122): SimpleStatistics->set()
#1 /var/www/html/index.php(1109): SimpleStatistics->collectData()
#2 /var/www/html/index.php(1484): Wcms->hook()
#3 /var/www/html/themes/sky/theme.php(81): Wcms->js()
#4 /var/www/html/index.php(1519): require_once('...')
#5 /var/www/html/index.php(182): Wcms->loadThemeAndFunctions()
#6 /var/www/html/index.php(16): Wcms->render()
#7 {main}
  thrown in /var/www/html/plugins/simple-statistics/class.SimpleStatistics.php on line 72" while reading response header from upstream, client: 41.33.162.241, server: daddymadu.xyz, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "daddymadu.xyz"
so in conclusion Simple Statistics plugin is only to be happy with apache servers and not nginx
it's not a big deal for me for now but it's the only Statistics plugin available for WCMS currently that gives some useful info regarding what visitors are interested in what.

that's it,
if you guys wanted to play with nginx on that server https://daddymadu.xyz i will leave ervery thing as it is, i can provide all ssh/ftp info for testing purposes it still has 30 days left to go! if you are interested just let me know.

wish you always the best
have a great day as usual.
User avatar
wiz
Posts: 757
Joined: Sat Oct 30, 2010 12:23 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by wiz »

Hello daddymadu, no problem at all and glad you got back with some research.
1- thank you for adding my name!
- Most welcome, you absolutely deserve it. Let us know if we need to change the website URL that we link to in case you change your domains.

One of these days I'll try to spin up on a hosting instance of WonderCMS on nginx and see if I run into the same issue.

first i was having unlimited lifetime hosting plan from long time ago it's serving lightspeed with apache server so i pointed an old domain to it
https://mtmreviews.co.technology/
installed WCMS and Simple Statistics plugin only and it worked smoothly as expected
so now i suspected my nginx instance
so to roll that out
i got 1$ domain https://daddymadu.xyz
and pointed it to another vps hosting 30 days for free basically running ubuntu 20.04
You also seem to find a lot of good deals on hosting and domains, really nice!

If you ever want to chat with the WonderCMS community, you can also check out our Github (https://github.com/robiso/wondercms) or our Discord https://discord.com/invite/2MVubVBCry

Thank you for being so pleasant.
Be safe and to a healthy, successful 2022!

Edit: Your WonderCMS forum account has been upgraded to Donor & supporter (it brings no obligations, but it brings a cool looking badge:)
daddymadu
Posts: 7
Joined: Sun Jan 09, 2022 2:52 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by daddymadu »

One of these days I'll try to spin up on a hosting instance of WonderCMS on nginx and see if I run into the same issue.
You also seem to find a lot of good deals on hosting and domains, really nice!

If you ever want to chat with the WonderCMS community, you can also check out our Github (https://github.com/robiso/wondercms) or our Discord https://discord.com/invite/2MVubVBCry

Thank you for being so pleasant.
Be safe and to a healthy, successful 2022!

Edit: Your WonderCMS forum account has been upgraded to Donor & supporter (it brings no obligations, but it brings a cool looking badge:)
oh! thank you wiz you're awesome!
sounds great, and for sure i will join discord!

if i can contribute, in wcms nginx conf doc

Code: Select all

        location / {
            if (!-e $request_filename) {
                rewrite ^/(.+)$ /index.php?page=$1 last;
            }
        }
according to nginx doc IF is EVIL
and should be replaced with try_files directive. we can replace this part with the following and it will be 100% safer

Code: Select all

location / {
    try_files $uri $uri/ @rewrite;
   }
    location @rewrite {
    rewrite ^/(.+)$ /index.php?page=$1 last;
   }
i tried it on my main instance and checked every part and it works as intended.

it was a pleasure having chat with you here!
wish you the same and beyond thank you!
User avatar
wiz
Posts: 757
Joined: Sat Oct 30, 2010 12:23 am

Re: [SOLVED] hello! bug report it's in demo site also wondercms 3.2.0 latest

Post by wiz »

Thank you @daddymadu!

Just to clarify, all you did was replace:

Code: Select all

# rewrite url to make it pretty
location / {
    if (!-e $request_filename) {
        rewrite ^/(.+)$ /index.php?page=$1 last;
    }
}

with the config part below?

Code: Select all

location / {
    try_files $uri $uri/ @rewrite;
   }
    location @rewrite {
    rewrite ^/(.+)$ /index.php?page=$1 last;
   }
Appreciate you looking into this.
Post Reply