Error: Wrong ‘suhosin.session.encrypt’ option value and it wasn’t possible to set it to required value (0). Check your PHP configuration

Error message: Wrong ‘suhosin.session.encrypt’ option value and it wasn’t possible to set it to required value (0). Check your PHP configuration

Scenario: It happened while running the web installer of roundcube on a server which had i-mscp installed on it.

Solution:

#cd /
#find . -iname suhosin\.ini
./etc/php5/conf.d/suhosin.ini

Now find out the required value:

#grep -in 'suhosin\.session\.encrypt' ./etc/php5/conf.d/suhosin.ini
50:;suhosin.session.encrypt = on

Change the “;” (semicolon) in front of line 50, and change “on” to “off”.

Reload apache2:

#service apache2 restart
Restarting web server: apache2 ... waiting ....

Now, retry the roundcube installer. It works now.

Background info: From: http://www.organicdesign.co.nz/Configure_mail_server#suhosin.session.encrypt_option_value_is_incorrect

suhosin.session.encrypt option value is incorrect

One issue is that on some systems the Roundcube installation procedure gives an error saying that the suhosin.session.encrypt option value is incorrect (it should be disabled) even though it says it is disabled in php.ini. The suhosin settings have their own php.ini configuration file in /etc/php5/apache2/conf.d/suhosin.ini which overrides the settings in the default php.ini. Change the line containing the suhosin.session.encrypt option in this file to disable it (and don’t forget to uncomment the line by removing the leading semicolon), then restart the web server and run the Roundcube installer again.

Note the difference in file path of suhosin.ini.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Some resources related to Bind and resource record files

Links:

Good file examples: http://www.omnisecu.com/gnu-linux/redhat-certified-engineer-rhce/domain-name-system-dns-zone-files.htm

Detailed explanation of each type of record: http://www.debianhelp.co.uk/dnsrecords.htm

File examples: http://www.skau.dk/index.php?option=com_content&view=article&id=2:dns

Full admin: http://computernetworkingnotes.com/network-administrations/dns-server.html

Other exhaustive descriptions:

http://support.f5.com/kb/en-us/archived_products/3-dns/manuals/product/3dns4_5_10ref/3dns_resourcerecs.html

http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.files%2Fdoc%2Faixfiles%2FStandard.htm


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

How to install owncloud on a Debian server

chown -R /var/www
apt-get -y install php5-curl mysql-server-5.5
curl https://download.owncloud.com/download/community/setup-owncloud.php -O
echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/ /' >> /etc/apt/sources.list.d/owncloud.list
wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/Release.key
apt-key add - < Release.key
apt-get update
apt-get install owncloud

Now, run the php installer:

http://mychosenurl/setup-owncloud.php

Now, just go along with the steps.

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Create a new Mysql database, create a new user and grant privileges on php

<?php
print "<html><body>";
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'nicole1983';

if(isset($_POST['database_name']) && ($database_name = $_POST['database_name'] <> "" )) 
{
	print "About to create database..";
	$database_name = $_POST['database_name'];

	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	if(! $conn )
	{
	  die('Could not connect: ' . mysql_error());
	}
	#echo 'Connected successfully';
	$sql = 'CREATE Database '.$database_name;
	$retval = mysql_query( $sql, $conn );
	if(! $retval )
	{
	  die('Could not create database: ' . mysql_error());
	}
	print "Database ".$database_name." created successfully\n";

	if(isset($_POST['database_user']) && ($database_user = $_POST['database_user'] <> "" )) 
	{
		$database_user = $_POST['database_user'];
		$sql = "CREATE USER '".$database_user."'@'localhost' IDENTIFIED BY 'secret';";
		$retval = mysql_query( $sql, $conn );
		if(! $retval )
		{
		  die('Could not create database: ' . mysql_error());
		}
		print "User ".$database_user." created successfully\n";
		$sql = "GRANT ALL ON ".$database_name.".* TO '".$database_user."'@'localhost';";
		$retval = mysql_query( $sql, $conn );
		if(! $retval )
		{
		  die('Could not grant privileges to user: ' . mysql_error());
		}
		print "Granted privieleges successfully...\n";
	}
	mysql_close($conn);
}
else
{
	print "<p>You didnt specify a database to create. Nothing will be done</p>";
	print '<p><a href="./createtable.html">Try again</a></p>';
}
print "</body></html>";
?>

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Server Connectivity: Unable to reach any Akismet servers. A network problem or firewall is blocking all connections from your web server to Akismet.com

How to solve the following problem:

“Server Connectivity: Unable to reach any Akismet servers. A network problem or firewall is blocking all connections from your web server to Akismet.com. Akismet cannot work correctly until this is fixed.Please contact your web host or firewall administrator and give them this information about Akismet and firewalls”

To solve this, you need to enable a setting in your php.ini file:

grep -in --color 'allow_url_fopen' /var/www/fcgi/joel.co.in/php5/php.ini
891:allow_url_fopen = off

As you can see, allow_url_fopen is by default set to Off.

You need to set it to On

allow_url_fopen = on

And then restart Apache. Now Akismet will start to work!


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Image has failed to upload due to an error – Missing a temporary folder

This error might have occured on WordPress for you: “Image has failed to upload due to an error – Missing a temporary folder”.

Reason?

  • It may be a permission issue for the php temporary folder
  • The php temp folder may not exist.

Solution?

  • Find the php.ini file for your webhost. 
  • Locate the temp folder
  • Create the temp folder if it does not exist
  • Give it proper permissions

In my case, I had transferred my site transhost, and hence this folder was actually missing.

My php.ini file (generated by i-mscp) was at this location: /var/www/fcgi/mysite/php5/php.ini

Once php.ini file was located, I needed to find the temp folder used by php:

#grep -in 'upload_tmp_dir' /var/www/fcgi/mydomain/php5/php.ini
875:upload_tmp_dir = "/var/www/virtual/mydomain//phptmp/"

Since this folder was missing, I created it and provided proper permissions and then restarted apache2:

#mkdir "/var/www/virtual/joel.co.in/phptmp/"
#chmod 755 "/var/www/virtual/joel.co.in/phptmp/"
#chown -R vu2003.www-data "/var/www/virtual/joel.co.in/phptmp/"
#service apache2 restart

Now, I could upload media files again.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Php not loaded (php files are being downloaded)

Check that php is installed properly.

In most of the cases, the following should work:

apt-get install libapache2-mod-php5
service apache2 restart

a2endmod may not be necessary.

When you install libapache2-mod-php5, you’ll notice that it will restart apache2 itself. Still, you need to execute the second and third commands before php actually works.

If you need a full installation, the following commands should be executed first:

apt-get -y install php5 php5-cli php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php-pear

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Installing SSL certificate on WordPress site in i-mscp, and forcing HTTPS/SSL in WordPress Subdomain

Installing the SSL certificate in i-mscp control panel was too easy. You need to enter the certificates in the panel:

User control panel>Manage domains>View certificates, under the SSL certificates tab.

Now enter the .key, .csr and intermediary certificate in the respective tabs.

Once done, you need to modify the .htaccess with rules to make it force SSL for everything. Note that this is optional. WordPress has options to force SSL for just login. However I prefer having SSL for everything.

My .htaccess looks like this:

#
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SERVER_PORT} !443 
RewriteCond %{HTTP_HOST} ^supernova.droidzone.in$ [NC]  
RewriteRule ^(.*)$ https://supernova.droidzone.in/$1 [R=301,QSA,L]

RewriteEngine On
RewriteCond %{SERVER_PORT} !443 
RewriteCond %{HTTP_HOST} !^note2.droidzone.in$ [NC]  
RewriteCond %{HTTP_HOST} !^blog.droidzone.in$ [NC]  
RewriteCond %{HTTP_HOST} !^forum.droidzone.in$ [NC]
RewriteCond %{HTTP_HOST} ^droidzone.in$ [NC]  
RewriteRule ^(.*)$ https://droidzone.in/$1 [R=301,QSA,L]

RewriteRule ^downloads/([^/]+)$ wp-content/plugins/download-monitor/download.php?id=$1 [L]

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

Note that the rules are read from top to bottom. So the first rule states that for urls matching anything beginning with supernova.droidzone.in, redirect it to an HTTPS url.

Next we set up SSL for the naked domain, excluding several subdomains from being included in the rule. This is so because the Class 1 certificate I received for free from StartSSL does not allow wildcard subdomains.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Enabling roundcube plugins on i-mscp

The list of available plugins is at:

l /var/www/imscp/gui/public/tools/webmail/plugins/ | awk '{print $9;}'

acl
additional_message_headers
archive
autologon
database_attachments
debug_logger
emoticons
enigma
example_addressbook
filesystem_attachments
help
hide_blockquote
http_authentication
imscp_pw_changer
jqueryui
managesieve
markasjunk
new_user_dialog
new_user_identity
newmail_notifier
password
redundant_attachments
serverinfo
show_additional_headers
squirrelmail_usercopy
subscriptions_option
userinfo
vcard_attachments
virtuser_file
virtuser_query

Plugins are activated if the name of their directory is added to an array in the roundcube configuration file located at /var/www/imscp/gui/public/tools/webmail/config/main.inc.php

By default, i-mscp activates only one of those plugins: imscp_pw_changer

To activate the plugins additional_message_headers and archive, I would change the line:

$rcmail_config[‘plugins’] = array(‘imscp_pw_changer’);

To:

$rcmail_config[‘plugins’] = array(‘imscp_pw_changer’,’additional_message_headers’,’archive’);

To get the linenumber of this line, just type:

grep -in 'plugins' /var/www/imscp/gui/public/tools/webmail/config/main.inc.php

Just restart apache2 and refresh your browser and you will see that the plugin has been activated. The complete list of plugins can be found at http://trac.roundcube.net/wiki/Plugin_Repository

To add a new plugin, extract the downloaded archive to its own directory at /var/www/imscp/gui/public/tools/webmail/plugins and add its name to the array list in /var/www/imscp/gui/public/tools/webmail/config/main.inc.php

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Default .htaccess for WordPress Multiuser

The following is the default .htaccess for WordPress MU:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.