When PHP’s mail function doesn’t work

mail-07[1]A lot of VPS’s do not have mail functionality right out of  the box, so if you install a stack like LAMP or maybe a WordPress install script (like you find on Linode or Digital Ocean) , and then try to send mail via your website, you will most likely get an error.

For example if your using Contact Form 7 in WordPress you will get “Failed to send your message”, not a very meaningful error.  So the first step is to troubleshoot the problem, login via SSH and type:

netstat -tulpn

This should show your servers open ports, there should be a mail program in there with a mail port open to 25 and/or port 465 (or 587) for SSL. If not then you will not be able to send any mail via PHP, unless you have configured a different port or remote service, all of which can be verified.

You can further test PHP’s mail by sending a test email using  PHP’s command line or putting the following into a PHP file.

mail ( 'your@email.com', "Test mail", "Test mail from your server name" );

Continue reading

Enabling Zend OPcache on Ubuntu and Apache

opcodeZend OPcache is the new open source opcode PHP cache that is now bundled with PHP 5.5. I had just upgraded one of my servers running Ubuntu 12.04 to use Apache 2.4.6 and PHP 5.5.4.

So how does one install it? I initially thought I had to just edit the php.ini file since there are a bunch of new settings for the opcache. I set mine similar to the recommended default and did not enable `cli` caching.


Restarting Apache however and I saw that it was still disabled , even though I had also set


Continue reading