Oct 12

file_exists(): Unable to find the wrapper https

This error message showed up in my log files when I try to CDN support.

file_exists(): Unable to find the wrapper ".http" – did you forget to enable it when you configured PHP

The solution to this problem is the following in PHP.ini file:


Oct 12

Install Redis 2.2.8 for PHP 5.6

Using Centos 7.0 and EasyApache 4, you can’t install Redis 2.2.8 for PHP 5.6

Easiest workaround is to use shell and following command:

pecl install channel://pecl.php.net/redis-2.2.8

Once it finishes installation, you should see the following lines:

Build process completed successfully
Installing '/opt/cpanel/ea-php56/root/usr/lib64/php/modules/redis.so'
install ok: channel://pecl.php.net/redis-2.2.8
configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini

You should go under WHM -> MultiPHP INI Editor -> Editor Mode -> Select PHP 5.6 -> add “extension=redis.so”

Nov 17

What is the best way to extract MP3 Length Duration in a directory? Windows

I recently had a task of identifying total duration of 1800 MP3 files in a folder. I used Powershell and other tools but I couldn’t get the most accurate information. Powershell only spits out “length” almost like Unix epoch time and now it is up to you to convert that into duration so it is dead end.

The solution is:
1- Install Winamp from http://winamp.meggamusic.co.uk/Winamp_Download.htm
2- Add all the MP3 files into Playlist.
3- At the bottom of the Playlist generator, you will see the total duration.
4- If you click on a MP3 file, you might lose the total duration. If that happens, select all in your playlist and it will automatically re-calculate.

That is it.

You can see attachment below:

Winamp Playlist Duration Calculator

Winamp Playlist Duration Calculator

Sep 29

XCache Best Settings

XCache is one of many opcode cachers that are available for PHP. There are many articles for nginx, apache, php and mysql best settings but I could not find one for XCache while I was struggling with configurations and I decided to put together this post.

I am assuming you already have XCache installed and you have either separate xcache.ini file or you are configuring inside php.ini. I would strongly urge you to install the XCache Admin panel or XCache dashboard. It helps a lot to get the best out of the settings.

You can use:

locate xcache | grep htdocs

to locate XCache Admin Panel. Once you locate it, you can copy it under your www folder. If you are using cPanel, it would be

 cp /home/cpeasyapache/src/xcache/xcache-3/htdocs /home/your_user_name/public_html/xcache -R

Once you copy this folder then you need to enable the Admin configuration from the php.ini file.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20100525"
; password cleartext md5(your_password_and_copy_the_output_to_below)

XCache settings that need your attention

  • xcache.admin.user – There is an HTTP authentication window when you access the admin page, this is the username
  • xcache.admin.pass – You need to create md5 password for authentication.
  • xcache.size – This is the most critical setting. xcache.size setting refers to the aggregate memory of all cache threads. So, each thread gets roughly size/count amount of memory. If you have multiple sites and around 4GB or more, 128M seems like a good number. Please beware, setting xcache.size to zero is equivalent to disabling xcache.
  • xcache.count – This number divides total cache size into threads in order to increase the efficiency. If you have 128M xcache.size and you set the count as 4, that means each thread will manage 32M size of cache.
  • xcache.slots – This is one of the most confused and least explained settings. According to XCache Wiki, Keeping xcache.slots small means more slots in memory thus better performance but more memory usage. I don’t really understand the logic behind it so I leave it as is.
  • xcache.var_size – Variable cache is different then regular cache. Do you need this or not really depends on your application. See below for further info.
  • xcache.var_count xcache.var_slots xcache.var_ttl are all alike their non-var versions so I skip them.
  • xcache.ttl=0 means we want file to remain in the cache forever.

XCache settings that you can’t care less

  • xcache.mmap_path=”/dev/zero” seems like beating the purpose but it is not. The reason you would write the output of a memory cache to a file is mainly to check and make sure you have the correct data. In other words, you would be doing read/write and read to make sure your data is safe. Dumping it to null means, you don’t care about the data consistency but just the performance and if something is broken in the cache, you are not too worried about it.
  • xcache.readonly_protection=”Off” – According to XCache Wiki, The cache can be corrupted by accident, it might be modified along the process – before or after the cache so the cache with readonly permission won’t allow this happen.
  • xcache.stat determines whether Xcache should check the filesystem to see if the file has changed or not.

XCache comes with two different caches

  • Static cache that are generated by compiling your PHP scripts
  • Variable cache that can be used by application through XCache API

If your application is not taking advantage of XCache variable cache then there is no need to enable variable cache so you would use xcache.var_size=”0″. W3 Cache for WordPress is able to xCache, there are other tools and plugins that are compatible with XCache but not all the software can take advantage of this storage.

I would highly recommend you to take a look at the Dashboard to see how XCache is performing for your environment and make the adjustments accordingly.

How do you reset XCache cache?

One last thing before finish, xcache var is reset when you restart the PHP service. If you are using PHP bound with Apache, restarting Apache will kill the cache. If you are using PHP like PHP-FPM, restarting PHP-FPM proxy service will clean the cache.

Please leave any comments and questions.

Apr 17

Gmail IMAP/HTTP Down

Gmail went down roughly 15 minutes ago (7:15 Central time on 04/17/13). When accessed from web interface, it gives the error message “Server error”. When accessed from Outlook, it pops up the username and password window then disconnects from server.

There are 150 reports on http://downdetector.com/status/gmail and twitter is full of people starting day with people complaining not being able to access to their emails.

Google Apps – Server error
Help|Sign out
Server error

We are unable to process your request at this time, please try again later.


Older posts «