Install dir or setup

Hi

I am fresh here and downloaded Open Energy Monitor from Github.
But what I am missing is the setup.php. I made a database but couldn’t find the sql for it.

Bert

you have to rename or copy/rename the default.settings.php file to settings.php
in there the first lines allow you to set the database logins
From there on it should go easy

Hello Eric

That’s what I did. But which script create the tables in the database?

Bert

The mySQL tables are automatically created when you register the first user.

1 Like

Hi Paul

I checked and it created the tables.
But the login was not saved. The user table is empty.

Bert

That’s odd, how did you create the first user? via the “register” button at the login screen?

If there was no user created/saved then the “register” button should still work, try again. The “register” button will disappear after the first user is created unless you set $enable_multi_user = true; in settings.php.

Can I do a new register?
Delete the tables?

Bert

No, you shouldn’t need to delete anything, you shouldn’t need to touch the mySQL at all.

It should be as easy as

  1. install emoncms
  2. navigate to http://server/emoncms and click register
  3. add name, email and a new password, via the browser.
  4. enjoy emoncms.

You do not need to touch the tables it all taken care of automatically.

If the register button isn’t there because of something you have previously done then retry the login details you previously tried to set up as the button will only disappear after the first user is successfully created.

Ok Paul

But first I want to say I am trying this on local host.

Bert

Ok so http://localhost/emoncms should work (or just http://localhost depending on how you configured it).

Paul

I am getting the message “undefined”

Bert

Had this problem first time I installed
In the instal directory there is a .htaccess file but on some computers these files are hidden and when you ftp them up to the server, you just forget to upload that file
It contains all the redirects for apache and this undefined error ‘might’ originate in missing the redirects

If you can unhide your files, do so else make a new file (on root level where you installed emoncms and call it .htaccess) on the host with the following code

# Apache/PHP/Emoncms settings:
#

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
 
  #RewriteBase /sites/emon/

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-s
  # Skip rewrites for known files, folders and 4xx/5xx errors so we know if something is wrong
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteCond %{REQUEST_URI} !=/robots.txt
  RewriteCond %{REQUEST_URI} !^/?docs.*$
  RewriteCond %{REQUEST_URI} !^/?Lib.*$
  RewriteCond %{REQUEST_URI} !^/?Modules.*$
  RewriteCond %{REQUEST_URI} !^/?scripts.*$
  RewriteCond %{REQUEST_URI} !^/?Theme.*$
  RewriteCond %{ENV:REDIRECT_STATUS} ![45]0[0-9]
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# ------------------------------------------------------------------------------
# The following are taken from html5 boilerplate
# url: https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
# ------------------------------------------------------------------------------

# ------------------------------------------------------------------------------
# | Proper MIME types for all files                                            |
# ------------------------------------------------------------------------------

<IfModule mod_mime.c>

  # Audio
    AddType audio/mp4                                   m4a f4a f4b
    AddType audio/ogg                                   oga ogg opus

  # Data interchange
    AddType application/json                            json map
    AddType application/ld+json                         jsonld

  # JavaScript
    # Normalize to standard type.
    # http://tools.ietf.org/html/rfc4329#section-7.2
    AddType application/javascript                      js

  # Video
    AddType video/mp4                                   f4v f4p m4v mp4
    AddType video/ogg                                   ogv
    AddType video/webm                                  webm
    AddType video/x-flv                                 flv

  # Web fonts
    AddType application/font-woff                       woff
    AddType application/vnd.ms-fontobject               eot

    # Browsers usually ignore the font MIME types and simply sniff the bytes
    # to figure out the font type.
    # http://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern

    # Chrome however, shows a warning if any other MIME types are used for
    # the following fonts.

    AddType application/x-font-ttf                      ttc ttf
    AddType font/opentype                               otf

    # Make SVGZ fonts work on the iPad.
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType     image/svg+xml                           svgz
    AddEncoding gzip                                    svgz

  # Other
    AddType application/octet-stream                    safariextz
    AddType application/x-chrome-extension              crx
    AddType application/x-opera-extension               oex
    AddType application/x-web-app-manifest+json         webapp
    AddType application/x-xpinstall                     xpi
    AddType application/xml                             atom rdf rss xml
    AddType image/webp                                  webp
    AddType image/x-icon                                cur
    AddType text/cache-manifest                         appcache manifest
    AddType text/vtt                                    vtt
    AddType text/x-component                            htc
    AddType text/x-vcard                                vcf

</IfModule>

# ------------------------------------------------------------------------------
# | UTF-8 encoding                                                             |
# ------------------------------------------------------------------------------

# Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
AddDefaultCharset utf-8

# Force UTF-8 for certain file formats.
<IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .jsonld .rss .vtt .webapp .xml
</IfModule>

# ------------------------------------------------------------------------------
# | Compression                                                                |
# ------------------------------------------------------------------------------

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
    #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
    #  as `AddOutputFilterByType` is still in the core directives).
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/ld+json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      application/xhtml+xml \
                                      application/xml \
                                      font/opentype \
                                      image/svg+xml \
                                      image/x-icon \
                                      text/css \
                                      text/html \
                                      text/plain \
                                      text/x-component \
                                      text/xml
    </IfModule>

</IfModule>

# ------------------------------------------------------------------------------
# | File access                                                                |
# ------------------------------------------------------------------------------

# Block access to directories without a default document.
# You should leave the following uncommented, as you shouldn't allow anyone to
# surf through every directory on your server (which may includes rather private
# places such as the CMS's directories).
# CHAVEIRO: documentation needs this disabled
<IfModule mod_autoindex.c>
#    Options -Indexes
</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Block access to hidden files and directories.
# This includes directories used by version control systems such as Git and SVN.

<IfModule mod_rewrite.c>
    RewriteCond %{SCRIPT_FILENAME} -d [OR]
    RewriteCond %{SCRIPT_FILENAME} -f
    RewriteRule "(^|/)\." - [F]
</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Block access to files that can expose sensitive information.

# By default, block access to backup and source files that may be left by some
# text editors and can pose a security risk when anyone has access to them.
# http://feross.org/cmsploit/

# IMPORTANT: Update the `<FilesMatch>` regular expression from below to include
# any files that might end up on your production server and can expose sensitive
# information about your website. These files may include: configuration files,
# files that contain metadata about the project (e.g.: project dependencies),
# build scripts, etc..

<FilesMatch "(^#.*#|\.(bak|config|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$">

    # Apache < 2.3
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
        Satisfy All
    </IfModule>

    # Apache ≥ 2.3
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>

</FilesMatch>

# protect phpinfo, only allow localhost and local network access
<Files php-info.php>
	Order Deny,Allow
	Deny from all
	Allow from 10
	Allow from 172
	Allow from 192
</Files>

Eric

But I am installing on localhost. I think no problems with the .htaccess file then.

Bert

localhost or remote host, it is still Apache and Apache needs to know where to go for some files. .htaccess tells it where to find them. Just try that already.

Eric

Yes I tried and it didn’t solved the problem

Bert

Someone else also had a problem being on Debian

here is the thread in case you’re also on Debian

Eric

I am on Windows

Bert

I’m afraid I have never installed on Windows, so may not be able to help much.

Have you enabled “mod_rewrite” ?

have you been following this windows install guide? (I’m unsure how up to date it is)

This getting started with emoncms | Archived Forum might help too. You also need gettext (or at least, used to need it).
I switched to Linux when Win 8 appeared, so I’m no longer up to date on Wampserver, though I did write it up somewhere in Building Blocks, if my memory serves. Try searching there and the old forum if you’re still stuck.

Where can I find the script for registering?
I am using PhpEd (Nusphere) and maybe I can debug this.

Bert