Solved: Webpack error “ERR_STREAM_DESTROYED” with “npm run watch”

When trying to use Laravel’s Mix webpack compiler, I was able to use “npm run dev” just fine, but I ran into the following error every time I tried to run “npm run watch”:

$ npm run development — –watch
@ development c:\wamp\www\***
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress
–hide-modules –config=node_modules/laravel-mix/setup/webpack.config.js “–watc
h”
10% building 1/1 modules 0 activeevents.js:288
throw er; // Unhandled ‘error’ event
^
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

After much frustration, I discovered that this issue was caused by running the npm run watch command in a non-Administrator terminal in Windows 7. Run your terminal as Administrator, and this error will go away. This is apparently the root cause of this error on a variety of Node projects.

Hope this saves somebody out there some time and frustration!

[SOLVED]: Laravel 5 Error “Undefined function Illuminate\Encryption\openssl_cipher_iv_length()”

After updating to Laravel versions 5.5 and 5.6 following an upgrade of PHP from v5.6 to v7.2, I experienced the following Laravel error:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

The function openssl_cipher_iv_length is a part of the OpenSSL PHP library, and most instances of this error seem to be fixed by uncommenting out the the extension in php.ini.

However, in my case, the extension was uncommented and I still got this error. After checking with phpinfo(), however, it turned out that OpenSSL wasn’t active on the PHP installation!

I later discovered that, since I am running on windows,  I had not included the two OpenSSL DLLs libeay32.dll and ssleay32.dll in the PHP 7.2 directory. After copying these from the old PHP installation and restarting the server. OpenSSL was reported as functioning by PHPInfo and the Laravel openssl_cipher_iv_length error vanished.

So if you have this problem, your PHP OpenSSL extension is not working, for one reason or another!

Annulet.com: The Secret, Overcharging Registrar of Buydomains.com

If you’ve ever had the misfortune of buying a domain from the professional domain squatters at BuyDomains.com, you’ll notice that they send you login details to access your new domain at a shady, unknown registrar called “Annulet”. This is a registrar with no homepage, a clipart logo, and a layout that looks like it’s fresh from 1995. Sound suspicious yet?

Well, that’s because it is. Despite their attempts to make it seem that Annulet is its own distinct registrar, that just so happens to be the default registrar when you purchase a BuyDomains name, the truth is that it’s wholly owned by Namemedia Inc, the same company that controls BuyDomains.

Even better, compare their renewal prices to the going rate of $6.99/year for a .com!

Renewal

Please send your payment via PayPal Merchant services to account – [email protected]

one-year renewal fee: $51.00

Up to 30 days past expiration, one-year renewal fee: $51.00

Redemption

Please note, before sending funds please contact [email protected] to verify that your domain is in redemption and still retrievable.
If your domain has gone into redemption the following fee applies.

Redemption fee: $120.00 plus one-year renewal fee $51.00. Total: $171.00

Note: Annulet reserves the right to change or modify its fee at any time for services provided pursuant to this agreement.

So, in conclusion, BuyDomains isn’t satisfied with just taking thousands of dollars for that typo of your company name. They also hope you’re stupid enough to pay them six times the going rate for domain registrations in perpetuity.

Click the “Transfer” button as soon as possible, folks!

[SOLVED]: Kibana 5 not loading / 404ing when reverse-proxying in a subdirectory

I just solved an issue with Kibana 5 that many, many people seem to have experienced while trying to install the log analysis app in a subdirectory.

Because Kibana is insecure by default (something I hate about the otherwise-wonderful products made by Elastic), most sysadmins choose to install it locked to localhost only, and allow access by setting up a reverse-proxy using Apache or Nginx.

While many people reverse-proxy Kibana to the root directory of their server and have no issues, I wanted to put it in a subdirectory, /kibana, because I am running multiple services with web interfaces (like phpMyAdmin, etc) on the same server.

After adding /kibana as the basePath in /etc/kibana/kibana.yml, I added the following code to set up the reverse-proxy:


# Kibana Reverse Proxy
ProxyRequests On
ProxyPreserveHost On

ProxyPass /kibana http://localhost:5601/
ProxyPassReverse /kibana http://localhost:5601/


## Auth
AuthType Basic
AuthName "Kibana"
AuthUserFile /var/www/.htpasswd
Require valid-user

When I did this, I got a JSON output with a 404. Another post I saw suggested adding /app/kibana to the proxy rewrite location, however this yielded the error “Kibana did not load properly. Check the server output for more information.” A check of the web console showed that Kibana was trying to load resources from /kibana/bundles, which were 404ing.

The forums and even StackOverflow were full of people who had this problem, and no solutions. However, I finally found one: the rewriting issues are being caused because of a missing slash after /kibana in my proxy configuration. Change to this, and it all works:


ProxyPass /kibana/ http://localhost:5601/
ProxyPassReverse /kibana/ http://localhost:5601/

For good measure, I also added a redirect:


# Add stupid trailing slash that makes Kibana proxy work
RewriteCond %{REQUEST_URI} ^/kibana$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]

Hopefully this saved you some time.

Apple patents infrared technology that can be used to block photography or recording

Apple recently filed a patent (9,380,225) that could introduce technology allowing an infrared signal to be deployed that blocks iPhones from taking photos or video, aimed at usage in places like concert arenas and movie theatres.

http://www.patentlyapple.com/patently-apple/2016/06/apple-wins-a-patent-for-an-infrared-camera-system-that-originally-caused-some-controversy.html

I’ve commentated frequently about Apple’s positions on security and privacy, and based on their reactions to consumer privacy issues in the past (like the San Bernardino FBI case) they seem to do their best to protect user’s privacy, likely to avoid the press firestorm that would undoubtedly ensue if they appeared to be collaborating with third parties to censor or spy on their users.

The technology behind the patent they filed is interesting, and would certainly be valuable to certain businesses / performing artists – however, the existence of such a technology would certainly raise significant concerns about who could access it, and whether it constitutes censorship. It’s almost guaranteed that hackers would attempt to develop technology to trigger video blocking, and governments would also be likely to pursue this technology as well. These concerns are compounded with the fact that lawsuits would be highly likely, and could rule the use of such technology an invasion of privacy. Plus, iPhone users could simply switch to a competing handset (like Android) that dowsn’t implement this hardware.

It’s important to remember that big companies like Apple file literally thousands of patents, most of which are never used. Apple is a very publicity-smart company, and I believe it’s highly unlikely that they would ever introduce a controversial feature that would alienate their customers to the level that this technology likely would.

[SOLVED] MySQL cannot view or alter routine / procedure

Stored procedures are a powerful feature that is kind of on the fringe of MySQL, and I’ve run into many (highly infuriating) bugs when working with them.

The MySQL permissions ALTER ROUTINE, CREATE ROUTINE, and EXECUTE are used to grant users the ability to work with routines. However, when working with routines, it’s common to come across an issue where you are unable to view / edit the routine, and may get an error like this:

ERROR 1227 (42000) at line 49: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

In MySQL workbench, a bug in the GUI can even cause the entire application to crash when running into a permissions bug like this. Note that this error can occur even if your user has full permissions on the database they are trying to access a routine within.

The Solution:

MySQL stored procedures are weird. If you want to *alter* a routine, you must either be root / have super privileges, or be the user specified in the DEFINER of the stored routine.

If the user you are logged in as doesn’t fit one of these categories, you won’t be able to edit the procedure even if you have all permissions in that database. To fix the issue, log in as ROOT and change the definer of the procedure in question to the user you want to be able to alter the routine. Ta-da.

[SOLVED] Issues installing mod_cloudflare on CentOS 7

I was re-installing mod_cloudflare on a CentOS 7 webserver when I ran across a very frustrating error.

While the CloudFlare package website at https://pkg.cloudflare.com/ claims that they have RPM binaries available for CentOS 7 (installable with sudo rpm -ivh http://pkg.cloudflare.com/cloudflare-release-latest.el7.rpm), installing from their binary generates an HTTPD error referencing the httpd.conf doirective that loads the module:

LoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so

Running journalctl -xe shows the following errors the following errors occurring when httpd is launched:

httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/cloudflare.conf: Cannot load modules/mod_cloudflare.so into server: /etc/httpd/modules/mod_cloudflare.so: undefined symbol: ap_log_rerror

The solution – turns out CloudFlare’s binaries aren’t made to work out of the box with CentOS 7. That’s annoying. The solution is to download the source and compile it yourself, which is super easy:


cd /tmp
wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
apxs -a -i -c mod_cloudflare.c

This will automatically compile mod_cloudflare and load it in your httpd.conf. Just make sure any configuration changes you need are registered in /etc/httpd/conf.d/cloudflare.conf!

Getting cURL to work on PHP 5.6 for Windows

Apparently, it can be very hard to get the popular cURL extension running properly with PHP 5.6+ if you’re unfortunate enough to be running Windows. I had already discovered the discomfort of trying to install PHP 5.6.11 on WAMPserver so I could run Laravel 5 apps, but I didn’t foresee the problems I’d run into with cURL down the road.

Trying to run cURL in PHP yielded the following error:

Call to undefined function curl_init()

This led me to the PHP Error Log, which showed me that, while php_curl.dll was uncommented in my PHP.ini, it wasn’t be successfully loaded when I started up PHP:

PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\wamp\bin\php\php5.6.11\ext\php_curl.dll’ – The specified module could not be found.
in Unknown on line 0

Half an hour of annoyed Googling eventually led to a comment on the PHP documentation, which stated that the following steps should be carried out to enable cURL on PHP 5.6:

I had to also also copy libssh2.dll into my Apache24 folder for this to work with my PHP 5.6.2 installation. So altogether I had to do the following:

Move to Windows\system32 folder:
libssh2.dll, php_curl.dll, ssleay32.dll, libeay32.dll

Move to Apache24\bin folder
libssh2.dll

Uncomment extension=php_curl.dll

After copying the DLLs to their respective locations in my Wamp install and the System32 folder, I restarted Wamp and everything magically worked. Hopefully this saves you some of my frustration.

Google Adsense introduces “Page-level ads” with new mobile ad units

In September, Google started rolling out a new set of mobile-targeted ads – sticky-footer ads and interstitial ads. These ads are both part of a new type of ad referred to by Google as “Page-level Ads”, and differ from normal Adsense ads in that you place a small snippet of advertising code in your page’s header instead of placing individual ad units at specific locations on the page. Here are the new ad units, which must be individually enabled in your account before they can be used:

Adsense2

With this “Page-level ad code” in place, Google’s algorithms will determine where, and when, to place sticky footer ads or interstitials on your site. Page-level ads don’t count towards your three-ad-per-page limit, and Google claims that they will only be shown when it is optimal for maintaining user experience. Google stresses that both of these new ad types are easily dismissable by the user.

Both sticky-footer ads and interstitials were previously part of a closed beta, and have been in development since at least May when an Adsense engineer showed me the prototypes during a visit to the Google headquarters in Mountain View. However, Adsense publishers should soon begin seeing a banner pop up in their accounts inviting them to start using the new ad units:

ADsense1

More details can be found in the Adsense documentation for Page-level Ads:

SOLVED: Orange ‘Server Online’ Icon in WampServer

If WampServer is showing an orange ‘Online’ icon in the system tray, but your localhost is not responding, there’s an easy fix – which can be hard to find, since in my case there weren’t any errors in the Apache system logs.

If this problem appeared suddenly (i.e. WampServer was working before), there’s probably something that’s preventing Apache from using it’s preferred port (80 by default). Skype is a notorious offender here – close Skype, and you can usually start WampServer. If you cannot find out / change the program using Port 80, go into the Apache conf file and change the LISTEN parameter to a free port other then 80.