Jump to content

Fallen at the first hurdle...(MobileDetect)


grumpy
 Share

Recommended Posts

I am a newby to ProcessWire and to PHP.  I want to change my html designed website to dynamic and to have it show differently on mobiles, desktops etc.  Within my website I already use TNG software (PHP) which dynamically generates genealogy pages.

I have installed ProcessWire in a renamed directory in the root of my website (I had to uncomment and edit line 127 to RewriteBase /********/ to get the install to work).  I then decided to add the module MobileDetect. I carefully followed the instructions, creating a directory MobileDetect in the modules directory, and then uploading the unzipped contents of the MobileDetect module download into it.  Next I went into admin and hit the module install button and got the error message:

Error: Class 'Mobile_Detect' not found (line 67 of /blah/blah/blah/site/modules/MobileDetect/MobileDetect.module)

Since that happened, when I try to access my ProcessWire Admin I get an Internal Server error:

The server encountered an internal error or misconfiguration and was unable to complete your request.

Can anyone help get me back into ProcessWire please?

Link to comment
Share on other sites

First of all, welcome grumpy.

It looks like what has happened is that downloading MobileDetect doesn't download the library it depends on - https://github.com/serbanghita/Mobile-Detect which, if I understand correctly, should go in the /blah/blah/blah/site/modules/MobileDetect/lib/ directory.

Try downloading that and unzip it to the above folder. Fingers crossed, that should make everything work.

If, erm, it doesn't, come back here and we'll try something else.  :rolleyes:

  • Like 1
Link to comment
Share on other sites

Thanks for a quick reply DaveP.  I am a little perplexed by your reply having looked at the site you referred me to.  I have downloaded the zip file Mobile-Detect-Master.zip and unzipped it.  Are you suggesting that I put all of these unzipped files in the lib directory?  Two things before I do anything.

1. FYI I've looked in my /blah/blah/blah/site/modules/MobileDetect/lib/ directory and it would be a familiar site to old Mother Hubbard: it's empty, which is as I suspect you guessed.

2. Please take a look at http://modules.processwire.com/modules/mobile-detect/ which is where I downloaded it from.  I followed these directions to the letter.  If you scroll down towards the bottom of the page you will see a section called Error Handling which seems to bear a strong resemblence in part to my problem?

Link to comment
Share on other sites

I think the way the git repository for the MobileDetect module is set up assumes that you are going to do the installation via git commands on the command line. Downloading the zip and extracting it doesn't give you quite the same control, so there are other steps needed.

The Error Handling part of the instructions does refer to the same problem you have, but to resolve it, you'll need to manually download the dependencies (i.e. from https://github.com/serbanghita/Mobile-Detect), and extract them to the empty /libs/ folder.

Link to comment
Share on other sites

I downloaded Mobile-Detect-Master.zip and unzipped it.  I put all of those unzipped files etc.in the lib directory.  When I go to my Admin log-on page I still get:

The server encountered an internal error or misconfiguration and was unable to complete your request.

So I still can't get into ProcessWire any more.

Link to comment
Share on other sites

OK, lets try some troubleshooting.

Going back to your first post, I assume everything was working once you had sorted the .htaccess RewriteBase thing?

Try renaming the folder /site/modules/MobileDetect/ to something else (put an 'x' on the end for example). AFAIK that should prevent the module running, and restore pre module installation functionality.

Also, edit the /site/config.php entry to read

$config->debug = true;

which should give some helpful messages.

And take a look at /site/assets/logs/errors.txt to see if that tells us anything.

Link to comment
Share on other sites

I've done the above.  Yes it was all working before I tried installing the module (I couldn't have installed it without being in my Admin pages).  I've renamed the MobileDetect folder with an x as suggested.  I've enabled debugging in config.php. I then tried to get into my admin page. and I got the usual error:

Error: Class 'Mobile_Detect' not found (line 67 of /blah/blah/blah/site/modules/MobileDetect/MobileDetect.module)

In the errors.txt log page there is a long list of instances of the same error  as above and nothing else except that the last two are showing a user 'guest' and all of the rest had my superadmin username


How about if I delete all of my ProcessWire installation (having first saved my modified htaccess, then reinstall it and check it works.  Then transfer all the MobileDetect module files and all of the ones to go in the lib folder, and then try and install the module via admin?

Link to comment
Share on other sites

Did that. No change.  I've checked with my site host and they say that the've not done anything.  I've got a question:  When I installed ProcessWire i had to give a URL, username, password, email address etc.  The URL I gave was just a word changed from the default processwire.  Let us say I put xmas.  When I now look in the ProcessWire directory and subdirectories on my site there is no mention of xmas. So when I try and access mydomain/renamedprocesswire/xmas/ we get the error message mentioned previously.  Is something missing or am I doing something wrong?  mydomain/renamedprocesswire/xmas/ was the hyperlink from the setup completion page to my admin log-on and it did briefly work this morning.....

Link to comment
Share on other sites

I havcen't used the MobileDetect module, but I think the first step here is to get to back into the PW admin, so I would recommend deleting the site/modules/MobileDetect folder and then going into PHPMyAdmin and deleting the row from the modules table that is for this module.

Then if that is working, then maybe you can try installing the module again.

Link to comment
Share on other sites

As we were getting nowhere fast I took it upon myself to go back to step 1 and see what happens.  So I deleted the whole shooting match and started again.  The problem is NOT the module.  I uploaded the ProcessWire files and jumped through the install hoops via my browser (Firefox) and it finally confirmed my installation was susccessful.  Incidentally, one of the confirmations was for the creation of a file with the name of my admin url in it but I could not find it when I looked at the refreshed directories on my ftp website. 

Next I swapped browsers and tried to access my admin page from a different browser (Chrome).  It went to the same stage that my Firefox had been: with the final confirmations of setup, and the option to go to my admin page if selected.  So I did select and once I had put in my username and password it went to the normal operating page of ProcessWire (it said that I was logged in at the top).  All well and good so far?  Well.... I next logged out of ProcessWire and closed Chrome and Firefox.  Then I opened both Chrome and Firefox and both gave the same error message, the same as before:

The server encountered an internal error or misconfiguration and was unable to complete your request.

So I still cannot get into (or even see) my ProcessWire site.  Is it my imagination or does this smack of htaccess problems?

I

Link to comment
Share on other sites

The server encountered an internal error or misconfiguration and was unable to complete your request.

That usually means a 500 error, and a 500 error usually means an .htaccess problem. Which is why I asked this.  :P

Going back to your first post, I assume everything was working once you had sorted the .htaccess RewriteBase thing?

  • Like 1
Link to comment
Share on other sites

I thought it was, but with the benefit of hindsite, probably not.  Read my last post, and that is exactly what happened the first time as well except that I tried to instal MobileDetect before I logged out.  It all appeared to be working until I logged out and was unable to get back in again and had the rotten error message.

I have checked session.txt in the logs and it correctly shows that I logged in and out as I described.  Nothing since then as no page is showing to enable me to log back in.

There are several instances in htaccess of things to change in the case of 500 errors.  Am I correct in assuming that I should do each of these suggested changes one at a time and each time do a new install of ProcessWire but using the modified htaccess untill I hopefully strike lucky?

Link to comment
Share on other sites

 but I could not find it when I looked at the refreshed directories on my ftp website.

i just wanted to possibly clarify something - there would not be a directory - the admin is a processwire page, using the admin template, so you won't find that as a directory under FTP.

The server encountered an internal error or misconfiguration and was unable to complete your request.

this should leave an error_log somewhere on the server, usually - what does that say?

i'm also worried about the subdirectory setup; that could be an issue.

further it sort of sounds like you are already using a PHP script for your site and are possibly thinking of bootstrapping processwire to make it from hard coded to content-managed? Can you elaborate on which profile you installed?

lastly, you might want to consider creating a subdomain where you could temporarily house your processwire site, until it is ready. something like pw.mydomain.com, or dev.mydomain.com and then you would not be using a subdirectory; not that there is anything wrong with using the subdirectory, but you do need to know how to configure that..

Link to comment
Share on other sites

Hi Macrura,  You may well be right about a lot of what you suggest but I am seriously floundering here.  Not waving but drowning.

As I said right at the very top othis topic 'I am a newby to ProcessWire and to PHP.  I want to change my html designed website to dynamic and to have it show differently on mobiles, desktops etc.  Within my website I already use TNG software (PHP) which dynamically generates genealogy pages.'  Now, let us go back a week or ten days.  My website, designed in html by me, was on a Windows server.  In one directory and its subdirectories ran a php genealogy software called TNG (The Next Generation of genealogy software).  And everything was sweetness and light.

Then came a TNG upgrade from v9 to v10.  Over the years I had done many TNG upgrades without problem.  This time all of my genealogy pages disappeared from the browser.  The author of the software said that he thought it was because I was on such old versions of PHP and MySQL.  I then had a chat with my hosting providers who suggested that maybe it would be a good idea to move me over to a Linux server which had much more up to date PHP and MySQL, MySQLi etc.  Also it enabled me within their pricing structure to have a second database which I couldn't on a Windows server.  So I said OK.

Since then I still haven't managed to get either ProcessWire or TNG working on the Linux server.  I have managed to set a password protection on a directory using htaccess which involved determining the full path to that password file.  And it worked.  But as for the rest... I have currently given the TNG author all my site details and he is going to hit it with a stick and see if he can get it installed.  As to the ProcessWire, goodness only knows.

Your idea of a sub-domain sounds good to me.  All I want to do is quietly tinker over the coming months with a new version of my website which will include all the TNG generated stuff and also whatever else I choose to put into it.  While I am developing this new dynamic site where everything is cleanly displayed on desktops, mobiles etc., I still want to have my original site running as normal.  Also I don't want search engines trawling the new site until it goes live.

I should be most grateful for any advice you can give.

Link to comment
Share on other sites

@grumpy - right, that is quite a lot of info.

Having just now taken a quick look at TNG, both the public and admin demos, i think it would be good to make some points:

1.) The TNG is already it's own CMS of sorts: It has it's own database, admin panel, and it generates a complete frontend website.

How this is to be integrated with another CMS is something you have to figure out or plan. Options could include importing all of your TNG data into Processwire, and using it alone as the system for the genealogy; this could be a pretty big task depending on how many of the features of the genealogy system you use. But since you can build just about anything with PW, that is an option.

BTW - You may have noticed that there is already a Wordpress integration for it. Not that I would like to steer you away from Processwire, but at the least I think you should look at that option, since it may work 'out of the box'...

Processwire itself isn't going to generate any markup for you in terms of the mobile sites, aside from the basic responsive demo frontend it comes with..

Let me know if there are some more specific questions or issues that can be addressed!

Link to comment
Share on other sites

I've just found the following info about my host's configuration:

'Please note that access to the MySQL port 3306 is blocked externally and only allows traffic back and forward from our webservers to the MySQL server. This is for security reasons.'

Is this what is screwing up my attempts to install ProcessWire?

Link to comment
Share on other sites

Just been talking to my hosts tech help and they say that the Port 3306 business shouldn't make any difference. Apparently all that means is that an external MySQL server database cannot connect to my webserver and so to my database. (I think I got that right).  

Link to comment
Share on other sites

(This is just my opinion and may not be 100% technically accurate, but here it goes)

You shouldn't have any issues installing and using processwire, and based on your posts, the only way I can recommend for you to get a clean install is to completely sequester your PW install from all other things on your hosting; so in short:

1.) Create a subdomain from cpanel, and make sure it uses a folder not within any other currently used folder (e.g. not a folder inside your public_html)

2.) setup a new clean database only for PW (for example using mysql database wizard)

3.) upload latest dev of PW into your new subdomain folder

4.) access your subdomain from mysubdomain.mysite.com and run the install

post back any errors you see here

  • Like 1
Link to comment
Share on other sites

I just went through trying to install MobileDetect module and ran into the same issues.  

As far as I can see, It cannot be installed in the normal way, not even using Modules Manager (I tried).  I believe the individual would have to follow the explicit instructions to "Clone the module and place MobileDetect in your site/modules/ directory" and then know how to initialize and update the submodule.

Error handling

If you get the following error message:

Compile Error: require_once(): Failed opening required 'lib/Mobile_Detect.php' 
(include_path='.:/usr/local/Cellar/php55/5.5.16/lib/php')
(line 57 of /path/to/site/modules/MobileDetect/MobileDetect.module) 
you forgot to initialize and update the submodule. (The library is included as an git submodule so I can easily update.)
Just run

git submodule init
git submodule update
and everything should work as expected.

Anything else won't work and I know I don't have a clue how to work through the process of the git initialize and update.

I guess someone would have to read up on how that works or maybe the author of the module can provide the missing installation instructions.  What I'm trying to say is that everyone doesn't know git.

This problem is not a strictly PW issue.  I read through the thread and he had the install working.

Edit:  For reference, Here is the documentation talking about git init and git update

http://git-scm.com/docs/git-submodule

Edited by cstevensjr
  • Like 3
Link to comment
Share on other sites

... I did not notice this topic. I would appreciate using the corresponding topic or at least including a keyword like "MobileDetect" in the topic title.

I can definitely unterstand your point. Now you should be able to install the module the normal way. I removed the submodule and included the mobiledetect library via composer. Therefore the including path for the library changed but this doesn't matter for you. There is a new release version 0.0.4. 

  • 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...