Message: fsockopen() [function.fsockopen]: unable to connect to ssl:// (Connection timed out)

Re: unable to connect to ssl:// (Connection timed out)

This is the error you get if your server firewall is blocking port 587. This error message is usally given by a CMS or other PHP scripts that is unable to send messages to the Google SMTP server.

To resolve simply allow incoming and outgoing traffic through port 587 and restart your server firewall.

How to disable Plesk open_basedir restriction in effect

Some applications require open_basedir to be “loosened” a little, if you are installing an application such as ClickCart Pro then the open_basedir will need to be changed so that the installation can create the required sub directories and then complete.

Let’s assume your domain name is (no such luck, I know!)

# vi /var/www/vhosts/

Add the following lines:

<Directory /var/www/vhosts/>
php_admin_value open_basedir “/var/www/vhosts/”
php_admin_flag safe_mode off

Now we need to rebuild the apache configuration:

# /usr/local/psa/admin/sbin/websrvmng -u –

Job done, your open_basdir setting has been moved up one level (from /httpdocs to /) within your domain name sub folder.

How to set the default PHP.INI timezone

Messages in error_log: Please use the date.timezone setting, PHP Strict Standards:  strtotime() [<a href=’function.strtotime’>function.strtotime</a>]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting

The default timezone setting in your PHP.INI is not set.

Edit you PHP.INI using your favourite editor eg.

# vi /etc/php.ini

Change this:

; Defines the default timezone used by the date functions
; date.timezone =

To this:

; Defines the default timezone used by the date functions
date.timezone = "Europe/London"

This will resolve the problem.

How is PHP setup in your servers?

We have phpSuExec configured in our servers. As such, PHP is setup as FastCGI instead of an Apache module. This offers users security to the way PHP is used in a shared hosting environment.

Categories PHP

How do I change the PHP Mail() from address?

When using the PHP Mail() function you will find that the ‘from’ email address is often an unfriendly looking system email address sometimes even belonging to the root or system user, this can confuse your userbase as well as making it impossible for them to reply to any system messages that you send.

To make this change you first need to decide which email address you would like the from address to represent. This email address must exist on the server where your PHP Mail() function is being called, if the email address you choose does not exist, then your efforts will be wasted.

$result = mail(“”, “subject”, “message”, “From:\n”, “”);

Make sure that the exists on the server, if it does not, this will not work.

If you have any problems simply contact the Helpdesk for further assistance,

Categories PHP