Magento – Fatal error: Class Mage not found

Of corse, this can be caused by many different things, but if you’re stuck, without any ideas what could be wrong, than¬†try solution bellow. Compiler stores everything in one file and can cause problems with includes. Just clear compiler and disable it if you don’t need it of corse.

I was getting error like this:

Warning: include(Mage.php): failed to open stream: No such file or directory in /my/web/server/root/public_html/lib/Varien/Autoload.php on line 94 Warning: include(): Failed opening 'Mage.php' for inclusion (include_path='/my/web/server/root/public_html/app/code/local:/my/web/server/root/public_html/app/code/community:/my/web/server/root/public_html/app/code/core:/my/web/server/root/public_html/lib:.:/usr/local/share/pear') in /my/web/server/root/public_html/lib/Varien/Autoload.php on line 94 Fatal error: Class 'Mage' not found in /my/web/server/root/public_html/app/code/core/Mage/Core/functions.php on line 244

Just login into your shell and then execute commands bellow (without comments):

//clear compiler
php compiler.php clear
//disable compiler
php compiler.php disable

It is most likely that this will fix your problem. If not, keep digging ūüôā

Hope it helps.

Alpine PhotoTile for Instagram not showing images

If you’re using this WordPress plugin to show Instagram images gallery on your site, and you noticed that images don’t show anymore, chances are, that this is due to deprecated PHP¬†function¬†ereg_replace. recently I upgraded my PHP¬†version to 7.1 and this plugin stopped working. So, if you upgraded your PHP, this is almost certain¬†the cause of problem. There is how to fix this.

Error log was showing this:

2017/02/11 11:31:40 [error] 18865#18865: *4616 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function ereg_replace() in /path/to/site/public_html/wp-content/plugins/alpine-photo-tile-for-instagram/gears/alpinebot-display.php:58

So, open alpinebot-display.php with your favorite text editor and go to line where error is Рin this case 58. Just replace ereg_replace with preg_replace and it should work again.

Hope it hepls.

WHMCS – can’t add new tld to domains

I found this odd issue with WHMCS billing platform.¬†I wanted to add new tld to our domain pricing list, but when I clicked on Save Changes I’ll get notice that¬†tld was added, but it wasn’t¬†on domain list.

Just add/edit this in your php configuration – php.ini (default value is 1000):

max_input_vars = 5000

cPanel – create directory alias on domain

Creating aliases on cpanel server is easy – for domains. But when you want to create directory alias for files¬†outside of document root, there is no quick/click option in control panel. By directory alias I mean for example, http://mydomain.com/something. Where¬†/something is directory that is outside of your document root – public_html of domain. Another example, you have domain¬†mydomain.com and you want phpmyadmin¬†to be¬†accessible on http://mydomain.com/phpmyadmin, but phpmyadmin is installed outside of document root of¬† mydomain.com.¬†You’ll need directory alias. Here is quick way to do it.

Continue Reading

Directadmin – install Letsencrypt SSL certificate on server hostname

Letsencrypt is a revolutionary step forward on web security. Free, valid SSL certificates for everyone. I won’t write about how to install and config¬†letsencrypt on Directadmin machine. I will show only how to¬†generate and install letsencrypt certificate on your Directadmin hostname.

When you installed Letsencrypt on Directadmin and tried to install certificate for your server hostname, there is a possibility that you came to this problem: HTTP/1.1 400 Bad Request

Just do this:

cd /usr/local/directadmin/custombuild
./build update
./build letsencrypt

And than install certificate on your server hostname:

/usr/local/directadmin/scripts/letsencrypt.sh request my.serverhostname.com 4096

Open your Directadmin configuration file and change

SSL=0 to SSL=1

Also add this:

carootcert=/usr/local/directadmin/conf/carootcert.pem

Restart your Directadmin and you should be set.

PHP: SSL operation failed with code 1

If you installed PHP 5.6 or grater and your application returns something like this:

SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL...

Then there is a simple fix for that. You can override¬†default OpenSSL’s CA bundle with the one bellow.

  1. Download this cert bundle.
  2. Add this line to your php.ini file
    openssl.cafile=/path/to/your/downloade/cacert.pem
  3. Restart apache/nginx and you should be ok.

check_eximailqueue: query returned no output! [FIX]

If you are icinga/nagios user and dealing with exim, you probably know for wonderful plugin check_eximailqueue. This plugin warns you when there are specific amount of email in your exim mail queue. Usually this indicates spam.

I installed this plugin on CentOS 7 with Directadmin installed. When I was executing plugin locally, it worked fine. But when I tried to execute it remotely (from Icinga server), it failed.

This was error returned when executing from Icinga server:

> # /usr/local/libexec/nagios/check_nrpe -H my.serverhostname.com -c check_exim_queue
Mailqueue WARNING - query returned no output!

I added “nagios¬† ALL=(ALL) NOPASSWD:/usr/sbin/exim” to my /etc/sudoers file but error still persisted. I manually set Exim and sudo path in script. Error was still there.

If you check your nrpe process, you’ll see that it runs by¬†nrpe user and not nagios!

[root@da ~]# ps -aux | grep nrpe
 nrpe 26993 0.0 0.0 46356 1460 ? Ss 10:44 0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

Solution is very simple.¬†Just change “nagios ALL=(ALL) NOPASSWD:/usr/sbin/exim” ¬†to “nrpe ALL=(ALL) NOPASSWD:/usr/sbin/exim”¬†¬†in your /etc/sudoers – replace user nagios with nrpe. It should work.

I hope it helps ūüôā

Directadmin – block zip attachments with ClamAV and Exim

A lot of¬†viruses and malware¬†is¬†sent in emails with zip attachments. Sometimes your antivirus like ClamAV wont catch nasty email. This is a big¬†problem when you receiving tons of this kind of messages. So if you’re receiving tons of¬†nasty emails¬†containing¬†zip attachments with viruses in it, good way¬†to solve this is by simply reject emails with zip attachments. This was done on¬†Directadmin server with Custombuild 2.0. Even if you’re not using Directadmin, configuration¬†for ClamAV should be very identical.

  • If you built Exim and Clamav with Custombuild 2.0, than you should see this line in your /etc/exim.conf. Uncomment¬†if it’s not already. If you’re using Custombuild 1.2, then this should be changed in /etc/exim.conf directly – settings¬†in step 2 bellow.
    .include_if_exists /etc/exim.clamav.conf
  • Open file¬†/etc/exim.clamav.conf and find word¬†demime within that file. Then¬†simply add zip to it. It should look like this:
    #1.0
    deny message = This message contains malformed MIME ($demime_reason)
    demime = *
    condition = ${if >{$demime_errorlevel}{2}{1}{0}}
    deny message = This message contains a virus or other harmful content ($malware_name)
    demime = *
    malware = *
    deny message = This message contains an attachment of a type which we do not accept (.$found_extension)
    demime = bat:com:pif:prf:scr:vbs:zip
    warn message = X-Antivirus-Scanner: Clean mail though you should still use an Antivirus

Now any email with zip attachment will be rejected. Sender will receive error message like this:

The error that the other server returned was: 
550 This message contains an attachment of a type which we do not accept (.zip)

Directadmin – enable and configure Spamassassin automatically on creating user

By default, when you add new user in Directadmin, Spamassassin is disabled. Some users are not aware¬†about Spamassassin, so they’ll have it disabled and will receiving a lot of spam. It is¬†good practice to enable Spamassassin by default and also set¬†some settings. You can do that by adding below code in your /usr/local/directadmin/scripts/custom/user_create_post.sh script. The first step is well described on Directadmin documentation. But you may also want to define some parameters for Spamassassin when user is created. It’s really simple. You can do that by manipulating filter.conf file. Steps below are preformed on¬†Directadmin running on FreeBSD. It should be the same for Linux also.

Continue Reading

Install PHP extension on Directadmin – fast and easy way (without custombuild)

Directadmin is pretty good, lightweight, control panel for¬†providing web hosting service or to host your own websites/projects, managing mail …¬†Through the years, I recompiled PHP¬†with¬†custombuild countless times. Problem is, that every time that you want to install some new PHP extension – exif, in this example¬†– you’ll have to rebuild whole¬†PHP¬†with Directadmin’s custombuild¬†also. That can be very annoying and time-consuming. Expesialy¬†when things go wrong. So, there is simple way on how to quickly¬†install PHP¬†extensions without using custombuild. I used this way many times. In this case, installation was done on CentOS 7.2 server with Directadmin and PHP version¬†5.6.23.

I hope this was helpful to you in any way.

Continue Reading

© 2017 geegkytuts.net
Hosted by Hosterdam


About author