Category: Control Panels

FileZilla Error: Failed to retrieve directory listing

Problem

When you try to access an account using a regular (unencrypted) FTP session after upgrading to FileZilla version, you receive the following error messages:

Error: Connection timed out
Error: Failed to retrieve directory listing
This issue does not apply to SFTP connections. SFTP connections continue to function normally.

If you are unsure which FileZilla version is installed on your computer, follow these steps:

  1. Start FileZilla.
  2. On the Help menu, click About.

Resolution

FileZilla forces TLS encryption on plain FTP connections. This applies both to new sites you create in the Site Manager, as well as any sites you have previously configured.

You can resolve this problem by resetting your accounts to use plain, unencrypted FTP connections. To do this, follow these steps:

  1. Start FileZilla.
  2. On the File menu, click Site Manager.
  3. Under Select Entry, click the site.
  4. On the General tab, in the Encryption list box, select Only use plain FTP (insecure).
  5. Click OK.
[Total: 2    Average: 5/5]

Tutorial Litespeed Multiphp

The default installation of LiteSpeed Web Server provides external applications for PHP5 and PHP7. With cPanel and other hosting control panels, though, administrators can provide even more versions of PHP (e.g. PHP 5.5.30 or PHP 5.6.16  PHP 7.0.0). Providing these multiple versions in LiteSpeed requires further customization of your setup. This document details the steps needed to create custom PHP script handlers in the control panel environment (cPanel, DirectAdmin, Plesk, etc) to provide for multiple PHP versions. Enabling multiple PHP versions provides flexibility to suit different end user needs and improves service quality.

When using LSWS with a control panel, users’ web server configurations (httpd.conf files) are managed via the control panel. LSWS can manage server-level settings, but has no control over the the individual user level (the virtual host level). LSWS instead reads these user-specific configurations via the Using Apache Configuration File settings at the server level. Thus, to make multiple PHP versions available to users, some settings can be set through the WebAdmin console while other settings are changed directly through directives in the appropriate files. The following steps are required:

  • Multiple external applications need to be created in LSWS at the server level. Each external application will correspond with a compiled PHP binary (different PHP versions or same version with different extensions).
  • Script handlers need to be set up in LSWS at the server level to correspond with each external application created. This step essentially creates MIME types for each php binary built.
  • To configure special MIME types at the user level, AddHandler, AddType, or ForceType directives need to be added in httpd.conf or .htaccess files.

Procedure

1. Compile multiple PHP versions (with needed extensions) for LSWS via command line.

  './configure' '--prefix=/usr/local/lsws/lsphp5530' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp5530/etc/' '--with-sqlite=shared'
'./configure' '--prefix=/usr/local/lsws/lsphp5616' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp5616/etc/' '--with-sqlite=shared'
./configure' '--prefix=/usr/local/lsws/lsphp70' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed' '--with-config-file-path=/usr/local/lsws/lsphp70/etc/' '--with-sqlite=shared'

It is also possible to compile different LSPHP versions from the WebAdmin console (Actions → Compile PHP). Doing so from the WebAdmin console, though, puts each LSPHP build in /usr/local/lsws/fcgi-bin/lsphp-version(i.e. /usr/local/lsws/fcgi-bin/lsphp5530 for LSPHP 5.5.30). Because of this naming convention, you can use the WebAdmin console to compile PHP ONLY IF you do not use PHP builds of the same version but with different extensions. 

2. Set up each PHP version binary as an LSAPI type external application (with a unique name) in LSWS at the server level. (LSWS WebAdmin Console → Configuration → Server → External App → Add) Sample settings below:

     lsphp55 --> PHP 5.5.30
           Name: lsphp55
           Address: uds://tmp/lshttpd/lsphp55.sock 
           Command: /usr/local/lsws/lsphp5530/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200
     lsphp56 --> PHP 5.6.16
           Name: lsphp56
           Address: uds://tmp/lshttpd/lsphp56.sock
           Command: /usr/local/lsws/lsphp5616/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200
     lsphp54 --> PHP 7.0.0
           Name: lsphp70
           Address: uds://tmp/lshttpd/lsphp70.sock
           Command: /usr/local/lsws/lsphp70/bin/lsphp
           Auto Start: Yes
           Memory Soft Limit(bytes): 200M
           Memory Hard Limit(bytes): 300M
           Process Soft Limit: 200
           Process Hard Limit: 200

Note: The socket addresses can be anything, but they must be unique. Memory limits and process limits given are for reference. Modify as needed.

3. Each external application must have script handlers set up at the server level to tell the web server which scripts to send to which application. Script handlers are set up in the LSWS WebAdmin console. (LSWS WebAdmin Console → Configuration → Server → Script Handler → Add) Sample script handler settings are below:

        suffix --> ext app
        ===================
        php 5.5.30 --> lsphp55
        php 5.6.16 --> lsphp56
        php 7.0.0  --> lsphp70

Creating script handlers automatically creates MIME types for the suffixes you stipulate. (This only happens for the first suffix stipulated in each script handler’s settings. Additional suffixes require that you set up a corresponding MIME type manually in LSWS WebAdmin Console → Configuration → General → MIME Settings.) The MIME types automatically set up for the suffixes stipulated above would be:

 
        application/x-httpd-php55
        application/x-httpd-php56
        application/x-httpd-php70

4. You and your users can now go into your files and change file suffixes so that each script goes to the proper application (and thus the proper version of PHP). You can also use directives (in httpd.conf and .htaccess files) to manipulate how the server translates suffixes into MIME types. It is these MIME types, not the actual suffixes on the file, that the server looks at when assigning scripts to script handlers. Thus the AddType, ForceType, and AddHandler directives can change which script handler a file goes to, even if the actual suffix is not changed. For example, the following in a .htaccess file would cause all .php files in that directory to be processed by PHP 5.5.30 (because it would be sent to the lsphp55 external application):

          
        AddType application/x-httpd-php55 php

The directive below would also have the same effect:

        AddHandler application/x-httpd-php55 php

Another way to solve the problem is to use the ForceType directive. ForceType in a .htaccess file changes all files in the directory to a single MIME-type. The following command would cause all files in this directory to be sent to the lsphp55 external application:

        ForceType application/x-httpd-php55

If you want to use multiple PHP versions for files in the same directory, you will have to change some suffixes. In the following example we’re using all three versions of PHP for files with different suffixes in the same directory:

        AddType application/x-httpd-php56 php56
        AddType application/x-httpd-php55 php
        AddType application/x-httpd-php70 php70

Note: The latest PHP version compile remain default but you can change it at your desire in /usr/local/lsws/fcgi-bin

lrwxrwxrwx 1 root root 7 Nov 25 13:54 lsphp4 -> ./lsphp*
lrwxrwxrwx 1 root root 37 Dec 22 15:45 lsphp5 -> /usr/local/lsws/fcgi-bin/lsphp-5.6.16*     (delete  this symlink and create a new one with your desire php version)
lrwxrwxrwx 1 root root 11 Dec 22 13:03 lsphp7 -> lsphp-7.0.0*

 

Problems that can be easy resolved:

PDO extension when native PDO is being used and it does not appear to be loaded.

add to php.ini configuration  /usr/local/lsws/lsphp5616/etc/php.ini

extension=pdo.so
extension=pdo_mysql.so

[Total: 2    Average: 5/5]

DSO (mod_php) vs. CGI vs. suPHP vs. FastCGI

What are PHP handlers

In order to run a PHP site, the server must interpret the PHP code and generate a page when visitors access the website. It interprets the code based on which PHP library you are using, such as PHP 4 or PHP 5. A PHP handler is what actually loads the libraries so that they can be used for interpretation. PHP handlers determine how PHP is loaded on the server.

There are multiple different handlers that can be used for loading PHP: CGI, DSO, suPHP, & FastCGI. Each handler delivers the libraries through different files and implementations. Each file and implementation affects Apache’s performance, because it determines how Apache serves PHP.

It is critical for your server’s performance that you select the handler that fits your situation. Selecting the right handler is just as important as the PHP version itself. One handler is not necessarily always better than another; it depends on your unique setup. What caching do you need, what modules do you need, etc…

  • Note: You may assign different PHP handlers to different versions of PHP. For example, version 5 may be handled by CGI while PHP 4 is handled by DSO.

How to change the handler

Changing the handler on cPanel is very easy to do and only takes seconds. Log into WHM and navigate to: Main >> Service Configuration >> Configure PHP and SuExec

You simply select your PHP handler choice from the drop-down menu. Then hit “Save New Configuration”.

  • Note: If you do not see your desired choice in the drop-down menu, it may need to be compiled on the server first. Run an “Easy Apache” to compile it.

List of PHP handlers

DSO (mod_php)

DSO is also known as mod_php. DSO stands for: Dynamic Shared Object. This is an older configuration but is generally considered the fastest handler. It runs PHP as an Apache module. This means that PHP scripts will run as the Apache user, which is the user: ‘nobody’.

DSO has two drawbacks. First, all files created by a PHP script will have the ownership of ‘nobody’. They will not be readable from the web. Websites that need to upload files through PHP will run into file permission issues. This is common with WordPress users that upload files through the WordPress interface or utilize the auto-update feature. These will fail with DSO.

The second drawback is a security issue. Created files will have the ‘nobody’ ownership. If a hacker finds an exploit in your PHP script, they could implement a file that has the same privileges as important system files that are also owned by ‘nobody’. This will give them the ability to modify files outside of that user’s account. This is really bad for anyone who does reselling or simply is hosting other person’s sites. You would not one user to be able to affect another user. However, if there is only one account on the server (or if all the accounts are yours), then DSO may be right for you. The speeds benefits of DSO are unquestionable.

An easy way to prevent the hack issue is to always keep your site’s software up to date. Check with your PHP script’s developer to keep up on the new releases. If you are the only one being hosted on the server, this is easy to do as it’s part of your webmaster duties already. However, if you’re reselling, it would be unreasonable to expect all your user’s to keep their software up to date. They simply may not be as diligent as you.

DSO’s low CPU usage typically amounts in higher speeds and load times over most other handlers. It is also the default setting on most servers.

CGI

CGI stands for: Common Gateway Interface. The CGI handler will run PHP as a CGI module as opposed to an Apache module. CGI still runs PHP processes as the Apache ‘nobody’ user. However, if you have suEXEC enabled, it will allow you to see the user that made the request.

The CGI method is intended as a fallback handler for when DSO is not available. According to cPanel’s own documentation, this method is neither fast nor secure, regardless of whether or not suEXEC is enabled.

http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/MorePhphandlers

suPHP

suPHP stands for Single user PHP. suPHP also runs PHP as a CGI module instead of an Apache module. It differs from CGI in that PHP scripts that are called from the web will run under the user that owns them, as opposed to ‘nobody’. suPHP is typically the default handler and is recommended by cPanel for serving PHP because you will be able to see which user owns the account that is running the PHP script.

suPHP is beneficial in that if you are using a file upload tool on your site (such as an automatic updater or theme/plug-in installer for WordPress), the files will already have the right ownership & permissions. Uploading and other WordPress functions will not work without suPHP or FastCGI.

suPHP also offers a security advantage that any php script that is not owned by the particular user (such as another account or root) will not be executable. Also, files that have permissions set to world writeable will likewise be non-executable. This means that if one account is compromised, the malicious scripts will not be able to infect other accounts.

The drawback is that suPHP generally runs a much higher CPU load. In addition, you CANNOT use an Opcode Cache (such as Xcache or APC) with suPHP. It is strongly recommend that you install a caching plug-in to supplement this ned. If you find that your server is still continually struggling with CPU usage, you will want to consider switching to DSO or FastCGI.

FastCGI

FastCGI (aka: mod_fcgid or FCGI) is a high performance variation of CGI. It has the security/ownership benefits of suPHP in that PHP scripts will run as the actual cPanel user as opposed to ‘nobody’. The difference with FastCGI is that it can drastically save on CPU performance and give speeds close to that of DSO. It can also be used with an opcode cacher like eAccelerator or APC, which can help further speed the loading of pages.

The drawback is FastCGI has a high memory usage. This is because rather than creating the PHP process each time it is called, like suPHP, it keeps a persistent session open in the background. This is what lets it work with an opcode caching software.

If you like the security/ownership benefits of suPHP and you can afford a major increase in memory usage (meaning you already have a low average memory usage), you may wish to consider using FastCGI.

Comparison Graph

DSO CGI SuPHP FastCGI
Low CPU usage
Low Memory consumption
Runs PHP as site owner instead of Apache

only w/ suEXEC
Good security
[Total: 1    Average: 5/5]

Modificare nameservere ROTLD

1. Pentru inceput trebuie sa accesati pagina web a RoTLD la adresa www.rotld.ro.

2.  In partea stanga veti gasi in meniu optiunea ” Administrare domenii ” iar sub aceasta, “On Line” . Click pe ” On Line “.

3. In careul ” Nume Domeniu” , introduceti numele domeniului pe care doriti sa-l configurati. In careul ” Parola ” introduceti parola aferenta. (daca nu o cunoasteti, folositi functia de Recuperare Parola). Introduceti codul anti-spam din imaginea alaturata si apasati Continua.

4. Odata logat, apasati ” Nameservers “. In partea de jos veti gasi ” Pentru a Crea/Modifica/Şterge un nameserver pe domeniul părinte numedomeniu.ro (Ex: ns.numedomeniu.ro) vă rugăm să accesaţi formularul. “. Click pe link-ul “Formularul”.

5. Odata ce ati ajuns in aceasta pagina, introduceti ns1 in careul ” Nume Server ” iar  la ” Adresa IP a Server-ului ” adresa IP oferita de furnizorul de web hosting, dupa care apasati “Creeaza Nameserver”. Introduceti din nou in careul ” Nume Server ” de data aceasta ns2 iar la ” Adresa IP a Server-ului ” adresa aferenta pentru al doilea server DNS oferit de compania de web hosting. La sfarsit, apasati din nou “Creeaza Nameserver”.

6. Apasati din nou Nameservers (in meniul de sus) dupa care in primul careu de sus introduceti ns1.numedomeniu.ro iar in a doua ns2.numedomeniu.ro (evident inlocuiti numedomeniu.ro cu domeniul dumneavoastra). In final apasati “Actualizeaza”.

7. Pentru a verifica daca setarile au fost aplicate, click din nou pe link-ul continut de cuvantul formularul, amplasta in subsolul paginii. Careurile Nameservers si Adresa IP trebuie sa fie de culoare roz.

8. Apasati Iesire (in meniul de sus) pentru a va deloga.

Daca setarile au fost realizate corect, in maxim 24 ore veti avea domeniul perfect functional din orice punct al Internetului.

[Total: 4    Average: 5/5]

Plesk 9.5 add smtp support for port 26

Plesk : Configure qmail to use alternate SMTP port 26

You have a plesk dedicated server and having issues related to SMTP port 25. There are issues where ISP blocks SMTP port 25, in this case we can use alternate port (I will use port 26).

Kindly follow the below steps to change SMTP port on your plesk dedicated (linux) server to 26.

Login to your server as root

root# cd /etc/xinetd.d

root# ls -l | grep smtp*

root# cat smtp_psa

service smtp

{

socket_type = stream

protocol = tcp

wait = no

disable = no

user = root

instances = UNLIMITED

server = /var/qmail/bin/tcp-env

server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true

}

root# nano /etc/services

Add the below lines

smtp_psa_new 26/tcp mail

smtp_psa_new 26/udp mail

root# cp smtp_psa smtp_psa_new

Change the service line in the new file “smtp_psa_new” to be this:

service smtp_psa_new

{

socket_type = stream

protocol = tcp

wait = no

disable = no

user = root

instances = UNLIMITED

server = /var/qmail/bin/tcp-env

server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true

}

root# /etc/init.d/xinetd restart

And you should see smtp listening on ports 25, and 26:

[Total: 0    Average: 0/5]