Menu Close

Category: Web Development

Apache2 returns Internal Server Error serving HTTPS pages

Sometime configuring Apache2 for SSL it could return Internal Server Error.

If we look at error.log we have:

.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

This message tell us that we don’t have the module Rewrite or the module is not enabled.

For solve this issue, we can simple do:

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

Set domain name and port on MAGENTO

 

I manage a magento site where a live shop is running on one server on port 80 and a dev site is running on another server on port 3000. When copying the site from live to dev all I need to do is change two rows in the core_config_data table, having:

  • path=”web/unsecure/base_url”
  • path=”web/secure/base_url”

You need to add your port number at the end of the url and that is all. In my case those two rows look like this:

(config_id, scope, scope_id, path, value)
(default, 0, web/unsecure/base_url, ,http://www.dev-server.com:3000/)
(default, 0, web/secure/base_url, ,http://www.dev-server.com:3000/)

Note that I don’t have a certificate on my dev server so I am not using https as the secure base_url. If you wish to use https this setting should be changed to https and you should omitt the custom port at the end.

Modification of the standard .htaccess file is not needed, and should probably be avoided.

Accesso a pannello amministrativo magento e magento connect

Il percorso per accedere al pannello amministrativo di magento è:

http://nomesito/magento/index.php/admin/

 

Provando ad utilizzare magento connect è possibile che esca il messaggio:

Warning: Your Magento folder does not have sufficient write permissions.

If you wish to proceed downloading Magento packages online, please set all Magento folders to have writable permission for the web server user (example: apache) or set up FTP Connection on the Magento Connect Manager Settings tab.

apache/php, serving php files for download instead of executing them

I have seen a couple of threads like this, but they were not very helpful.

My problem is: When I try to execute my php files in my browser from my ubuntu hardy server, the browser offers to download the files instead of the server proccessing them.

whats worse the file it allows me to download is not the proccessed output but the “code” file. these files could have database name, password and what not. Not so good!!!

For some reason though, my webmin works. (probably because its https and not http)

First off all, it has worked before. I haven’t used it for quite a while, but resently i updated webmin to version 1.500 (dont know if this is the reason for my problems), but I just noticed problems after the update.

Upgrade to the latest version of emoncms 3

by openenergymonitor.org

To upgrade to the latest version of emoncms:

1) Download the latest version and unzip to your chosen server directory

https://github.com/openenergymonitor/emoncms3

Or if you use git, use git clone when installing for the first time:

git clone git@github.com:openenergymonitor/emoncms3.git

and then all you need to call is git pull and it will download and update the latest changes.

Force HTML5 and HD for embedded youtube video

With the quantity of mobile devices that surfing in the net, and the recent news about not flash support on the new devices, the integration of html5 is needed for compatibility.

So, if you want to force HTML5 and HD for an embedded video, you can use this code:

 

<iframe src="http://www.youtube.com/embed/pmPNz8JJCm8?html5=1&vq=hd720"></iframe>

Modify AjaXplorer for show images in browser

If you want that AjaXplorer shows in browser images from generated public links, you can modify  class.fsAccessDriver.php (in Ajaxplorer4.3.3 is under plugins\access.fs\) at about Line 202:

 

AJXP_Controller::applyHook("dl.localname", array($this->urlBase.$selection->getUniqueFile(), &$localName, $this->wrapperClassName));
// $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
$Nomefile = $selection->getUniqueFile();
AJXP_Logger::debug("trovo l'estensione di ".$Nomefile);
$pathParts = pathinfo($Nomefile);
//if(isset($pathParts['extension']))
if (array_key_exists('extension', $pathParts))
{
    $ext = strtoupper($pathParts['extension']);

    AJXP_Logger::debug("estensione: ".$ext);

    $pos = strpos($_SERVER["REQUEST_URI"] , "public");

    if ($pos !== false) {
        if ( $ext == 'JPG' || $ext == 'BMP' || $ext == 'PNG' || $ext == 'JPEG')
        {
            $this->readFile($this->urlBase.$selection->getUniqueFile(), "image", $localName);
        }
        else
        {
            $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
        }
    }
 else
    {
        $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
    }
} else { $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName); }

With a bit of code I check if the current request it’s done from a public url, and in this case I force the visualization of the image instead of simple download it.
I have to check Request_URI for “public” because otherwise when you press the “download” button inside ajaxplorer the browser opens the image instead of download it.

 

If you need to enable debug mode, you can modify conf/bootstrap_context.php with:

define("AJXP_SERVER_DEBUG"  , true);