Couple of years ago I wrote an article about two PHP configuration options auto_prepend_file and auto_append_file recently while browsing about PHP minification I got an idea on how to apply this PHP minify code to each and every script executed on the server so that all HTML output from that server are auto minified. This method requires creating a PHP file containing the code to strip whitespaces and newlines before and after the HTML tags and including this file with every PHP script executed on the server using the auto_prepend_file configuration option. For this you need to have access to the php.ini file. This method will work fine even if you are using shared hosting with custom php.ini support.Continue Reading…
How to use MSMTP with Gmail, Yahoo and PHP Mail
This is a three in one tutorial which combines how to use MSMTP to send mails via Gmail and Yahoo servers and how to use MSMTP with PHP Mail() function instead of the default sendmail.
Installing msmtp
To install msmtp on Red Hat/CentOS/Fedora type of distributions
yum install msmtp
To install msmtp on Debian/Ubuntu type of distributions
apt-get install msmtp
Configuring msmtp with Gmail and Yahoo
Create or edit the msmtp configuration file in the user’s home directory. I use VI editor to achieve this
vi ~/.msmtprc
Add the following lines to the file, it configures msmtp for both Gmail and Yahoo
account yahoo tls on tls_starttls off auth on host smtp.mail.yahoo.com user user1 from user1@yahoo.com password ******
account gmail tls on auth on host smtp.gmail.com port 587 user user1@gmail.com from user1@gmail.com password ******
Since the file contains sensitive data like passwords you should assign secure permissions
chmod 600 ~/.msmtprc
PHP auto_prepend_file and auto_append_file
This article will show you how to use the PHP configuration directives auto_prepend_file and auto_append_file. These two PHP directives perform the same function as require() but they do it globally on all PHP scripts. The PHP auto_prepend_file and auto_append_file directives can only be used in php.ini files. They do NOT work when used in .htaccess file, I’m mentioning this so that you don’t waste precious time editing your .htaccess file. If you want to set these configuration directives on directory basis you can use them in your custom php.ini file.Continue Reading…