glennmckechnie / weewx-wxobs

extracts archival data from the weewx database using php
GNU General Public License v3.0
7 stars 1 forks source link

wxobs fatal error #5

Closed pimohdaimaoh closed 4 years ago

pimohdaimaoh commented 5 years ago

heres the error issue which the data doesnt shown:

Warning: require(): open_basedir restriction in effect. File(/usr/share/php/wxobs_weewx.inc) is not within the allowed path(s): (/opt/awex-pages:/storage/ssd5/169/1132169) in /storage/ssd5/169/1132169/public_html/pimohweewx/wxobs/index.php on line 79

Warning: require(/usr/share/php/wxobs_weewx.inc): failed to open stream: Operation not permitted in /storage/ssd5/169/1132169/public_html/pimohweewx/wxobs/index.php on line 79

Fatal error: require(): Failed opening required '/usr/share/php/wxobs_weewx.inc' (include_path='.:/usr/share/pear:/usr/share/php') in /storage/ssd5/169/1132169/public_html/pimohweewx/wxobs/index.php on line 79

heres my site to it: http://pimohweather.webutu.com/pimohweewx/wxobs/index.php

I hope you may assist me how to resolve this. Thank You

glennmckechnie commented 5 years ago

You appear to be using a web hosting service so your set up is classed as a "Remote Installation". This is because the sql database is inaccessible (it only exists on your local machine) and there will be restrictions with files on the remote server, in particular location and permissions. To get around this we copy the weewx sql database to the web hosting services machine, and move the include file to another location.

As you have it setup now, it should all be accessible from your local machine, if you view it on the webserver you have running locally. You only need to configure it as a "Remote Installation" if you want it to be accessible to everyone. Configured correctly (and providing the webhost doesn't have further restrictions, and your sql database is not too large to transfer) it will then be viewable from both webservers.

The error page you are displaying, besides describing those errors also has a link to the wiki page that offers help with a Remote installation. (at the bottom of the red section -- https://github.com/glennmckechnie/weewx-wxobs/wiki/Remote-installation )

Under the heading, Configuring the remote transfer on that wiki page you'll see an option regarding the dest_directory =

This allows you to place a copy of your weewx sql database and the include file in a location readable by the hosting services webserver. I don't know what areas they might offer but it has to be readable by their webserver, and preferably secured from the public.

If it's not secured from the public, (eg:- uder the /pimohweewx/ directory) then that means that a copy of your weewx weather database will be available, and exposed on the internet. If that will be a problem, then don't proceed with the Remote Installation side of it, and stick to having it accessible as it is ... locally.

pimohdaimaoh commented 5 years ago

Hello there glenn,

Thank you for your reply and sorry for some delay, my email lately informed me this reply. Well. . how should I do it? I try to change the location of wxobs, not lucky because I cannot relocate due to restrictions, I try to dissabling its restrictions but it didnt succeed. I try to run its raw using my desktop pc localhosts, but it says it needs mysql thing.

Is there anyway which I could edit its skin.conf? I dont know how to acces its skin.conf, maybe I should edit its .conf because when I check it using putty and viewing it into txt file, it shows "/tmp" for remote mode, maybe I should change that and theres settings that i should uncomment it.

Hope you can give simple tips of accessing skin.conf and how to edit those for newbies like me. Thanks

regards

-mike-

glennmckechnie commented 5 years ago

I'm not privy to your providers setup so I can't help with any bypassing of their configuration. You need to find out out what they offer as a work around and work with that, do they have a FAQ, forums? Can you setup .htaccess / .htpasswd areas?

You mention "raw" and "mysql thing" without any context. Neither of those make sense to me. I can guess at the mysql, but a guess is all it is. More information is required if I'm to get anywhere near a meaningful answer.

You don't provide any background to your setup. I assume you have a local weewx installation running a local observer PWS and that you upload to a remote server controlled by webutu.com? I assume the upload is by using one of the services that weewx provides, is it FTP or RSYNC?

Does it work on your local machine? A fresh install should work, on a standard weewx install, without any config modifications. The only issues may be php not being enabled on the webserver.

What database is your weewx installation using - sqlite or mysql? This is a fairly crucial piece of information to know.

Again; a standard (local) install of weewx uses sqlite and it should "just work" with that. It should also work with mysql, but variations in installations may add a roadblock; but if you've jumped through the hoops to switch weewx from sqlite to mysql then they should be self evident. Critically: With mysql you need to be able to access your weewx mysql database from the internet side. This is not for the faint hearted and requires an above average understanding of security and risk. It is quite doable, but the downside is huge if you make a mistake.

A weewx skin is configurable through it's config file, skin.conf That file exists only on your weewx installation, it does not exist on the remote server. If you are seeing /tmp then that's a commented example in the config file. ie:- It's not the default. Did you change it?

Re-reading your comment suggests it's an untouched file on your web server (because you are using putty to view it) but I don't know for certain and it only confuses things, there should be no skin.con file on the webserver so again, where is weewx actually installed? Is at home or is it too remote, but just not on the webserver.

All the configuration settings are in that skin.conf file mentioned above, if there's nothing that suits within there then you've hit a unique situation.

You need a user writeable (uploadable) and webserver readable location to store the database and the php include file. A machine that has both weewx and the webserver installed on it satisfies this (what I call a local install) A remote install is where weewx and the webserver are on 2 separate, distinct machines. Depending on who owns the remote machine determines how the include files and database are transferred and accessed.

Did you read the skin.conf section that I mentioned previously (that the wiki link refers to)? Did you take note of the path suggestion? Admittedly it's insecure but "/somewhere/that/the/remote_server/can_read_from " (ie:- where your web directory is) is the obvious starting point and if you can secure it with .htpasswd or .htaccess files then its possibly all you need (besides bandwidth).

There's no doubt that there are better locations, your provider knows those. Again, ask them where a php include file can be placed, where a database can be placed. Can rsync access them? Adjust skin.conf (dest_directory) accordingly.

pimohdaimaoh commented 5 years ago

Hello glenn,

I guess I have to reinstall wxobs, yes my wxobs installed at /var/www/html/weewx/wxobs and the wxobs_weewx.inc is located at /etc/weewx/skins/wxobs and yes my local server on raspberry pi cant open the page instead its automatically downloads the index.php instead of viewing it on the page I know /var/www/html/weewx/wxobs is permitted for .php and I dont know how is still not permitted to view. I have to reinstall this to make it sure, will update you for the results. Thank You for the replies

glennmckechnie commented 5 years ago

If you can't view the index.php page on your local server then the local webserver is not dealing with php extensions. It won't be anything to do with weewx itself.

To check, create a file named phpinfo.php in your local webserver space. Add the following as its contents, then save the file.

'<?php

phpinfo();

?>'

If you now open that very short file with your browser, and you have php enabled as a working module for the webserver, you will have a long page returned with a lot of information about your php installation. If instead it displays or downloads as text, you definitely don't have php enabled in your server.

You need to install the php module, ...if it was apache2 then something like - libapache2-mod-php7.3 (or similar, maybe version 5 for a pi?) ...if it was lighthttpd then fastcgi-php ...nginx might use fastcgi as well? (perhaps try the nginx-extra package)

depending on what you are using you may need to take an extra step to enable the module, ie: just installing the package may not be sufficient. You have to make the conscious step to enable and use it.

If none of that fixes the php side then I'm certainly puzzled.