Author: Merioles

NGINX bind() to 0.0.0.0:80 failed (98: Address already in use)

I recently tried adding a new site configuration for NGINX and just did what we normally do &mbsp; sudo service nginx restart. The weird thing is, my site configuration is okay (run sudo nginx -t to test your config) so something else might be wrong right? Like what any good Geekysaur would do, we won’t stop until we find the root cause! I proceeded to look at NGINX’ runtime log using sudo nginx and saw the following error messages: XHTML nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address...

Read More

Module was not compiled with the same compile-time options as this version of Asterisk

The voicemail module of our Asterisk server suddenly stopped working after an update which prompted a barrage of reports from the end users. Of course, like what any good Geekysaur would do, we did what we do best — find a solution! First things first, the Asterisk full log. We are looking for any mention of “VoiceMail” and found No application 'VoiceMail' for extension (macro-vm, s-BUSY, 3). This tells us that the VoiceMail module is probably not loaded. Next, let’s try loading the module! Shell asterisk -r module load app_voicemail.so # This could be any app you're having an...

Read More

Check and Enable/Disable PHP Modules from a Linux Command Line

Sometimes you need to check what PHP modules are enabled on your server without going through all the hassle of creating a web page with a phpinfo(); in it. Like what any good Geekysaur would do, you could just make use of the handy-dandy Linux command line to get what you’re looking for! Shell # To see a list of all active modules. php -m # To filter the list for a specific module. php -m | grep <module_name> # To enable a PHP module. sudo php5enmod <module_name> # And of course, to disable a PHP module. sudo php5dismod <module_name> 1234567891011 # To see a list of all active modules.php -m # To filter the list for a specific module.php -m | grep <module_name> # To enable a PHP module.sudo php5enmod <module_name> # And of course, to disable a PHP module.sudo php5dismod <module_name> That’s all there is to it! Did this work for you? Do you have a better way of doing this? Help your fellow Geekysaurs by hitting us up in the comments...

Read More

PHP Error: Use of undefined constant MCRYPT_RIJNDAEL_128

While crafting a new Laravel application, I encountered the following PHP error: XHTML Use of undefined constant MCRYPT_RIJNDAEL_128 1 Use of undefined constant MCRYPT_RIJNDAEL_128 Like what any good Geekysaur would do, I checked my server’s PHP configuration. At first glance, one would think that there’s an error in the code and this specific variable has just not been defined. Looking at the PHP configuration though (you could take a peek using phpinfo()), you would notice that the MCRYPT module has not been installed or enabled. So what do we do? We have to install that module of course! To do that, just run the following: Shell # If you have not installed it yet. sudo apt-get install php5-mcrypt # We have to enable the module after installation as it's not being done by default. sudo php5enmod mcrypt # Then we just have to restart Apache. sudo service apache2 restart # Or sudo service nginx restart if using nginx. 123456789 # If you have not installed it yet.sudo apt-get install php5-mcrypt # We have to enable the module after installation as it's not being done by default.sudo php5enmod mcrypt # Then we just have to restart Apache.sudo service apache2 restart# Or sudo service nginx restart if using nginx. That’s it! You shouldn’t have any problem installing Laravel or seeing this issue on your web application. Did this solve your problem? Do you have...

Read More

CodeIgniter – Adding Custom Email Header Information

I’m currently implementing SendGrid for a project I’m working on and one of their features is the ability to add Categories, Scheduling, Sections, etc. by making use of a custom email header named X-SMTPAPI. The project was made on CodeIgniter so of course we’d be making use of its built-in email library. Details on adding custom header information, however, is not readily available on their documentation. Like what any good Geekysaur would do, I tried Googling for the solution. There’s not much relevant results on the topic (hence this blog post) and when I did find one, it required modifying the core email library. I frown upon modifying core framework files as it becomes a maintenance nightmare later on so I looked for other ways to achieve my goal. The Solution The core email class has a protected method named _set_header which was responsible for setting the email headers. We don’t want to modify this or make it public but looking at that function showed us that it’s actually just setting a class variable. PHP $this->_headers[$header] = $value; 1 $this->_headers[$header] = $value; Looking further at the variable, I discovered that it is not private or protected and is accessible from outside the class. So, from your controller, you could just call it as: PHP $this->email->_headers['X-FOO'] = 'bar'; 1 $this->email->_headers['X-FOO'] = 'bar'; There you have it! Did this help you? Have you...

Read More