Jump to content

Unable to access Admin Area on Testing Server


KG60
 Share

Recommended Posts

I have a couple of websites on my laptop, which I can view and edit without any issues. If I then upload the website onto my local testing server, and import the sql file, the site shows perfectly, but I am unable to log in to the admin background area. I type in my user name and password, select Login, and the screen stays the same but the username and password are cleared again. Admin login details work perfectly on my laptop.

The login details are correct, as they are exactly the same as on my laptop.

Laptop Details: MacBook Air, running MacOS Sonama 14.2.1 & Ampps (Apache 2.4.58, PHP 7.4.33, MYSQL 8.0.31). Processwire 3.0.165 with htaccess file @IndexVersion 300
Server Details: Linux server running Rocky Linux 8.9 & CWP (Apache 2.4.57, PHP 7.4.33, MySQL 10.4.32-MariaDB + nginx & varnish) Processwire 3.0.165 with htaccess file @indexVersion 300

I tried disabling nginx & varnish but this didn't resolve the issue. The difference in MySQL versions should be irrelevant, as the site works fine using both.

Can anybody possibly shed any light as to what might be the issue?

Link to comment
Share on other sites

hi,

there may be various reasons for this, the first i tend to think about is have you changed this line in the config.php file

$config->httpHosts = array('localurl.test');

to fill the quotes with the domain (or sub...) your website is on online ?

have a nice day

Link to comment
Share on other sites

Hi virtualgadjo,

Thanks for the suggestion. I have checked the config.php file, and the line you mention shows as 'localhost'. I have changed it to my domain name, and also the IP addresss, but it doesn't make a difference. My domain name currently points to the test server, until I am ready to make my sites live.

I can edit the site on my laptop, and upload the sql to the test server, but it would be nice to be able to edit on the server directly when it is close to being ready for going live. 

Link to comment
Share on other sites

hi,

you don't need the ip address, i even tend to think it's not a good idea... 🙂
the problem seems to be your ddb as it's not really usual to have database servers hosts opened to external request

actually, i often do what you're describing but with the domain name alive with a splash page  saying coming soon 🙂 ( or the former version) and the future website in a subdomain
this way, no nedd to change the bdd credentials when the website is ready you just have to change the domain path into the "real" website and change that httphosts line in the config file, job done

well, you can, while working with the preprod version add a meta robot noindex in the head you'll remove once online as you never know wether  the master of the world, aka google 🙂 will find the preprod version or not and then reference it which is obviously not what you want...

but honestly this way you can work with you dev version, even give a client the admin credentials, and when going live with this simply changing the domain path in your hoster panel, no need to change anything about the ddb

this of course if your dev server is the same as the future live one
 

Gideon was faster the i 🙂

have a nice day

Link to comment
Share on other sites

53 minutes ago, Gideon So said:

Hi @KG60

Go to site/assets/logs and check the error log to see if there is any useful information for you to investigate the problem.

Gideon

I've looked in there. No errors that relate to this. All old errors. Good suggestion though. 🙂

Link to comment
Share on other sites

Hi,

Do you see something special in browser debugging tools, in network tab and JS console?

Did you copy the site/config.php, to use the same salts?

$config->userAuthSalt = 'xxx';
$config->tableSalt = 'yyy';

 

Link to comment
Share on other sites

3 hours ago, da² said:

Hi,

Do you see something special in browser debugging tools, in network tab and JS console?

Did you copy the site/config.php, to use the same salts?

$config->userAuthSalt = 'xxx';
$config->tableSalt = 'yyy';

 

I've used the debugging tools and the only errors appear to be linked to the AdminOnSteroids plugin. I've now uninstalled it, but it's not resolved anything. The config.php is exactly the same on both machines. The site is working fine, it's just that I am unable to access the Admin area on the server, even though it works fine on the laptop.

I'll keep checking things out. 

Link to comment
Share on other sites

6 hours ago, virtualgadjo said:

hi,

you don't need the ip address, i even tend to think it's not a good idea... 🙂
the problem seems to be your ddb as it's not really usual to have database servers hosts opened to external request

actually, i often do what you're describing but with the domain name alive with a splash page  saying coming soon 🙂 ( or the former version) and the future website in a subdomain
this way, no nedd to change the bdd credentials when the website is ready you just have to change the domain path into the "real" website and change that httphosts line in the config file, job done

well, you can, while working with the preprod version add a meta robot noindex in the head you'll remove once online as you never know wether  the master of the world, aka google 🙂 will find the preprod version or not and then reference it which is obviously not what you want...

but honestly this way you can work with you dev version, even give a client the admin credentials, and when going live with this simply changing the domain path in your hoster panel, no need to change anything about the ddb

this of course if your dev server is the same as the future live one
 

Gideon was faster the i 🙂

have a nice day

Thanks for your suggestions. I worked this way for years previously, but just had the domain name pointing to a splash page, informing anybody that it was the customers testing server, then redirecting to our proper site. Any client sites we had as subdomains, as you mentioned.

I can't see the database being linked to the domain name making a difference though. I have a couple of test sites as subdomains, one Processwire and one just static HTML. They both work fine but the Processwire site also won't allow me to log into the Admin area. I never had this problem with the old server, which was Centos 7 using Webmin. I might try removing the main site though and replacing it with a splash page, just to test your theory.

I've not done any web stuff for quite a few years, and decided to try getting back into it to keep me busy during retirement. I'm a bit rusty with it though, as the last version of Processwire I used was v2.3. I don't give in easily though, so I'll keep plugging away. 🙂

 

Link to comment
Share on other sites

20 minutes ago, da² said:

Is debug allowed in config.php? (to see errors)

Is MySQL user configured with right permissions in this database? (user specified in config.php)

The MySQL user is configured correctly, otherwise the site wouldn't show correctly. The site allows me into admin on my laptop, and it's the exact same config file. It's not really a big file, so there's not a lot to get wrong in it in all fairness. It's not a show stopper, so I'll keep digging. I just hoped somebody may have come up against the same problem at some point.

I'll post my solution when/if I do find the source of the problem though.

Thanks

 

Link to comment
Share on other sites

hi @KG60
well, i don't think the problem is coming from whether the main website is a splash page or not
reading your posts i see a few usual first questions
- the server; url rewriting working or not, if the pw website works, it does and so should do the htaccess
- this famous httphost line in the config (without protocol but i'm sure you know)
- the database, well if the website works with its right content, should be good too
- the user you use to log in, have you creates guset users or any kind of users other than you as the super user and aren't you loging with one of them wsth some kind of maintenance mode on

you see, all those kind of silly first questions we ask ourselves with the normal what have i done wrong 🙂

honestly when going online with a pw website that works locally, the only things to check are
- have i put all the needed files on the server (ftp, ssh or whatever you use)
- have i set the right
-- database credentials
-- and httphosts in the config file
- and if needed have i changed (usually uncomment) the right things in the htaccess file, www or not, ssl or not
but if the website itself works, all this should be ok
you could also check the php version, between 5.6 (not a good idea :)) and say 8/8.1 (depending on the pw version you're with) for pw but depending on potential modules you've installed, 7.x and above may be needed

when stuck like this, if i could, one thing i would do is to add another subdomain and to create a separate database and then try to install a fresh blank pw to see if everything works, if not, you'll soon know why, if yes, sorry, you may have forgotten something somewhere  🙂

have a nice day
 

Link to comment
Share on other sites

8 hours ago, Gideon So said:

Hi @KG60

$config->debug

$config->debug = true

Can you add the above to the config.php file to see if there is any error show when you login?

Gideon

Hi Gideon

The config debug line is already in the config file, and it doesn't return any errors.

I think I'll follow virtualgadjo's suggestion and add another subdomain, then do a completely fresh blank ProcessWire install. If that works, then I can start doing a comparison between config & htaccess files. If it doesn't, then I can start looking into how I have Apache configured on my test server.

Thanks for your suggestions. They're much appreciated.

Link to comment
Share on other sites

3 hours ago, virtualgadjo said:

hi @KG60
well, i don't think the problem is coming from whether the main website is a splash page or not
reading your posts i see a few usual first questions
- the server; url rewriting working or not, if the pw website works, it does and so should do the htaccess
- this famous httphost line in the config (without protocol but i'm sure you know)
- the database, well if the website works with its right content, should be good too
- the user you use to log in, have you creates guset users or any kind of users other than you as the super user and aren't you loging with one of them wsth some kind of maintenance mode on

you see, all those kind of silly first questions we ask ourselves with the normal what have i done wrong 🙂

honestly when going online with a pw website that works locally, the only things to check are
- have i put all the needed files on the server (ftp, ssh or whatever you use)
- have i set the right
-- database credentials
-- and httphosts in the config file
- and if needed have i changed (usually uncomment) the right things in the htaccess file, www or not, ssl or not
but if the website itself works, all this should be ok
you could also check the php version, between 5.6 (not a good idea :)) and say 8/8.1 (depending on the pw version you're with) for pw but depending on potential modules you've installed, 7.x and above may be needed

when stuck like this, if i could, one thing i would do is to add another subdomain and to create a separate database and then try to install a fresh blank pw to see if everything works, if not, you'll soon know why, if yes, sorry, you may have forgotten something somewhere  🙂

have a nice day
 

Hi virtualgadjo

The php version is 7.4 and is the same on both the laptop and the server. I'll follow your suggestion and do a complete fresh install on a new subdomain. If that works, then it's a case of comparing config and htaccess files to look for differences. If not, then there may be an issue with the configuration of my test server. (I'm using CWP instead of Webmin, so that's been a bit of a learning curve as well).

Thanks for taking the time to make suggestions. Much appreciated.

Link to comment
Share on other sites

hi @KG60

well php 7.4 you're in cotton 🙂
and yes, if you try a fuul pw install directly on the server and everything goes well, you will be able to compare those two files
the other things may also be the various php "extensions" that are installed locally as if you're are completly managing the online server using webmin, as you say, it's a little touchy and needs some learning curve
pw is not very needy in terms of requirements
https://processwire.com/docs/start/install/new/#requirements
but if you've installed some modules they may have their self requirements too

have a nice day and enquiry 🙂

Link to comment
Share on other sites

@virtualgadjo@Gideon So

🥳

Success....to a point.

When trying to install a fresh Processwire instance, I got the message that it was "Unable to determine if Apache mod_rewrite (required by ProcessWire) is installed" After checking, it appears that CWP does not enable it by default. 😒 After doing a rebuild on Apache, this has now created other 'none-ProcessWire' issues.

At least I now know that the problem is not ProcessWire related, but issues with the server configuration, and I can now start to work on those. CWP is a bit of a learning curve after Webmin, but it keeps the brain working. 😀

Thanks for your help.

Link to comment
Share on other sites

glad to "hear" you've found the origin of the issue 🙂
you may have been alerted, trying to see a page other than the homepage on the front side but you would just have seen it didn't work not knowing exactly why, sometimes the simplest and more "brutal" test helps as pw install warns you if there is anything it needs and doesn't find during the process :

good luck with cwp and my pleasure of course 🙂

have a nice day

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On Linux, enabling rewrite mode is usually as easy as writing:

sudo a2enmod rewrite
sudo systemctl restart apache2

Last command may depend on your distribution. More info: https://stackoverflow.com/a/5758551
("a2enmod" means "Apache 2 Enable Module")

You also need to set the "AllowOverride all" directive for this site (or in apache2.conf if there's no dedicated config for this site), if not set yet.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...