howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
425 stars 94 forks source link

Editor does not work #257

Closed theunknownport closed 3 years ago

theunknownport commented 3 years ago

Hey there, recently i tried to install network-weathermap as a standalone aplication, editor and command-line. My os of choice was linux ubuntu.

I downloaded version 0.98a and extracted everything. I installed php7.2, apache2, php7.2-gd and pear. I moved everything into /var/www/html/weathermap, added couple of lines in the apache security conf to regulate the access to the editor php and then tested everything with ./weathermap. $ ./weathermap PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /usr/share/php/Console/Getopt.php on line 135

Deprecated is not unsupported so... i just ignored this message.

Next up i ran the check.php which gave me this output: $ php7.2 check.php

PHP Functions
-------------
Some parts of Weathermap need special support in your PHP
installation to work.

This PHP uses the system GD library, which MIGHT have alpha-blending bugs.
Check that you have at least GD 2.0.34 installed, if you see problems with
weathermap segfaulting.
You can test for this specific fault by running check-gdbug.php

The Console_Getopt PEAR module is available. That's good!

            imagepng   YES                                                     
imagecreatetruecolor   YES                                                     
  imagealphablending   YES                                                     
      imageSaveAlpha   YES                                                     
          preg_match   YES                                                     
  imagecreatefrompng   YES                                                     
 imagecreatefromjpeg   YES                                                     
  imagecreatefromgif   YES                                                     
           imagejpeg   YES                                                     
            imagegif   YES                                                     
  imagecopyresampled   YES                                                     
        imagettfbbox   YES                                                     
    memory_get_usage   YES                                                     

---------------------------------------------------------------------
OK! Your PHP and server environment *seems* to have support for ALL of the
Weathermap features. Make sure you have run this script BOTH as a web page
and from the CLI to be sure, however.
</table>
</body>
</html>

Then i opened the editor.php in the browser and it said: "The editor has not been enabled yet. You need to set ENABLED=true at the top of editor.php"

So i checked the editor.php file, but there it was enabled. I added couple of debug lines to print some text out, so i can verify that apache uses the correct file. As it turns out it was the correct file but according to the message the editor was still turned off.

There were couple of other error messages on the editor page:

"; exit(); } // sensible defaults $mapdir='configs'; $configerror = ''; // these are all set via the Editor Settings dialog, in the editor, now. $use_overlay = FALSE; // set to TRUE to enable experimental overlay showing VIAs $use_relative_overlay = FALSE; // set to TRUE to enable experimental overlay showing relative-positioning $grid_snap_value = 0; // set non-zero to snap to a grid of that spacing if( isset($_COOKIE['wmeditor'])) { $parts = explode(":",$_COOKIE['wmeditor']); if( (isset($parts[0])) && (intval($parts[0]) == 1) ) { $use_overlay = TRUE; } if( (isset($parts[1])) && (intval($parts[1]) == 1) ) { $use_relative_overlay = TRUE; } if( (isset($parts[2])) && (intval($parts[2]) != 0) ) { $grid_snap_value = intval($parts[2]); } } if ($FROM_CACTI==false) { // check if the goalposts have moved if( is_dir($cacti_base) && file_exists($cacti_base."/include/global.php") ) { // include the cacti-config, so we know about the database include_once($cacti_base."/include/global.php"); $config['base_url'] = $cacti_url; $cacti_found = TRUE; } elseif( is_dir($cacti_base) && file_exists($cacti_base."/include/config.php") ) { // include the cacti-config, so we know about the database include_once($cacti_base."/include/config.php"); $config['base_url'] = $cacti_url; $cacti_found = TRUE; } else { $cacti_found = FALSE; } } chdir(dirname(FILE)); if(! is_writable($mapdir)) { $configerror = "The map config directory ($mapdir) is not writable by the web server user. You will not be able to edit any files until this is corrected. [WMEDIT01]"; } $action = ''; $mapname = ''; $selected = ''; $newaction = ''; $param = ''; $param2 = ''; $log = ''; if(!wm_module_checks()) { print "Required PHP extensions are not present in your mod_php/ISAPI PHP module. Please check your PHP setup to ensure you have the GD extension installed and enabled.

I checked if the gd plugin is enabled, and yes, it is.

I don't know whats wrong, maybe the apache2 installation, maybe the php plugins, idk

Thx for any help

theunknownport commented 3 years ago

On Debian/Ubuntu systems, you may also need to use the php5enmod command to enable the extension.

"; } else { print "\nIf these functions are not found, you may need to\n check that the 'extension=' line for that extension is uncommented in\n your php.ini file (then restart your webserver), or\n install the extension, if it isn't installed already\n\n"; } print wordwrap("The details of how this is done will depend on your operating system, and on where you installed (or compiled) your PHP from originally. Usually, you would install an RPM, or other package on Linux systems, a port on *BSD, or a DLL on Windows. If you build PHP from source, you need to add extra options to the './configure' line. Consult your PHP documention for more information.\n"); if($environment=='web') print "

"; } if($environment=="CLI") print "\n---------------------------------------------------------------------\n"; if($critical>0) { if($environment=='web') print " "; print wordwrap("There are problems with your PHP or server environment that will stop Weathermap from working. You need to correct these issues if you wish to use Weathermap.\n"); if($environment=='web') print " "; } else { if($noncritical>0) { if($environment=='web') print " "; print wordwrap("Some features of Weathermap will not be available to you, due to lack of support in your PHP installation. You can still proceed with Weathermap though.\n"); if($environment=='web') print " "; } else { if($environment=='web') print " "; print wordwrap("OK! Your PHP and server environment seems to have support for ALL of the Weathermap features. Make sure you have run this script BOTH as a web page and from the CLI to be sure, however.\n"); if($environment=='web') print " "; } } if($environment=='web') print ""; function return_bytes($val) { $val = trim($val); if($val != '') { $last = strtolower($val{strlen($val)-1}); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val = 1024; case 'm': $val = 1024; case 'k': $val *= 1024; } } else { $val = 0; } return $val; } ?>

-> check.php output in the web-browser

howardjones commented 3 years ago

If you are getting source code in the browser like that, your Apache PHP/mod_php config is either broken or missing.

theunknownport commented 3 years ago

yeah i reinstalled php apache module now it works thx for your help (:

howardjones commented 3 years ago

No worries - I think I might add a message to check.php for this:

# if you can read this, your PHP configuration is broken

or something along those lines :-)

theunknownport commented 3 years ago

Nice, thx 👍