Cloudlinux 7.1 and PHP Selector
  1. Forums
  2. General
  3. General Discussion
  1. Simon
  2. 23.10.2015
  3.  Subscribe via email
Rate this post:
  1. 23.10.2015 04:10:19
  2. # 1
Simon Accepted Answer
Posts: 4
Joined: 23.10.2015

I've installed a fresh Cloudlinux 7.1, registered and installed CageFS, LVM and PHP Selector. My goal is to run this server globally with a version of PHP 5.3. CentOS 7.1 comes with PHP 5.4 so this is the way I've used to temporary downgrade the version and in the future handle the upgrades.
From the yum output, all seems correctly installed. I've performed following commands:

yum install cagefs
/usr/sbin/cagefsctl --init
yum install lvemanager
yum groupinstall alt-php
yum upd ate cagefs lvemanager
selectorctl --list
selectorctl --current
selectorctl --set-current=5.3
cagefsctl --enable-all

I'm NOT using any WEB gui to manage sites like Plesk or whatever. I've a single virtual host. BTW, even if I've se t-up the default PHP 5.3 it continues to use the native PHP 5.4.

selectorctl  --current --show-native-version
5.3     5.3.29  /opt/alt/php53/usr/bin/php-cgi

If I open the browser pointing it to a test paghe with:

I got always the PHP 5.4.
I'm missing the part on how manually switch the PHP version for apache.

Any help?

Thanks a lot!
  1. 23.10.2015 05:10:51
  2. # 2
kernow Accepted Answer
Posts: 72
Joined: 06.08.2010
Did you restart Apache after making the changes?
  1. 23.10.2015 05:10:29
  2. # 3
Simon Accepted Answer
Posts: 4
Joined: 23.10.2015
Yes, I\'ve restarted it (apache 2.4).
Nothing changed. Is there a way to check-debug it? Maybe I\'m missing some steps :(
  1. 23.10.2015 05:10:24
  2. # 4
kernow Accepted Answer
Posts: 72
Joined: 06.08.2010
After you ran $ /usr/sbin/cagefsctl --init
Did you create the skeleton directory?
$ mkdir /home/cagefs-skeleton
$ ln -s /home/cagefs-skeleton /usr/share/cagefs-skeleton
  1. 23.10.2015 08:10:42
  2. # 5
Simon Accepted Answer
Posts: 4
Joined: 23.10.2015
As written in the DOC the init does the job. I need the steps you mentioned only if I have not enough space. Look:

# ls -al /usr/share/cagefs-skeleton/
total 76
drwxr-xr-x   13 root root   141 Oct 22 16:57 .
drwxr-xr-x. 122 root root  4096 Oct 22 16:57 ..
lrwxrwxrwx    1 root root     7 Oct 22 16:57 bin -> usr/bin
drwxr-xr-x    4 root root  8192 Oct 22 16:58 dev
drwxr-xr-x    2 root root     6 Oct 22 16:57 etc
dr-xr-xr-x.  28 root root  4096 Oct 22 16:55 lib
dr-xr-xr-x.  55 root root 36864 Oct 22 16:56 lib64
drwxr-xr-x.   6 root root    46 Oct 22 16:55 opt
dr-xr-xr-x  496 root root     0 Oct 22 16:50 proc
drwxr-xr-x    2 root root     6 Oct 22 16:57 root
drwxr-xr-x    3 root root    22 Oct 22 16:57 run
lrwxrwxrwx    1 root root     8 Oct 22 16:57 sbin -> usr/sbin
drwxr-xr-x    2 root root     6 Oct 22 16:57 tmp
drwxr-xr-x   12 root root   135 Jun 24 17:52 usr
drwxr-xr-x    9 root root    94 Oct 22 16:57 var

Also the dirs are ok, so I think.
I missing how apache knows to use the alternate version of PHP.
Looking on the loaded files:

# lsof | grep php
httpd     40048        apache  mem       REG              253,0    256560  405692052 /usr/lib64/php/modules/

Nothing points me that the alternate version is in use, that should be in a different path, in example, for pdo, not in usr/lib but in opt:

# locate

What I'm missing...?

I think not having any control panel, I need to setup the apache config files to point to the new php manually per virtualhost. So I need help on that (I think)
  1. 26.10.2015 04:10:56
  2. # 6
Simon Accepted Answer
Posts: 4
Joined: 23.10.2015

Thanks a lot for the link. I've made some steps forward, but I'm getting some errors. I've corrected the setup to match the CentOS 7.1 version.
So, switching to the user I can see the right php version:

# php -v
PHP Warning:  PHP Startup: No such handler: gdbm in Unknown on line 0
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

# su - my_user
Last login: Mon Oct 26 09:02:52 CET 2015 on pts/2
-bash-4.2$ php -v
PHP 5.3.29 (cli) (built: Aug 19 2015 10:05:30) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

The document root of the site is located here:
DocumentRoot /home/my_user/jail/ramdisk/my_site/

I've recompiled suexec as well and it matches now:

# suexec -V
 -D AP_DOC_ROOT="/home"
 -D AP_GID_MIN=500
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/usr/local/apache2/logs/suexec_log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=500
 -D AP_USERDIR_SUFFIX="public_html"

BTW a phpinfo shows me always the default php.
Does the "AP_USERDIR_SUFFIX" have something to do not matching the default users DocumentRoot?

Here my httpd conf:

        ServerName www.my_site
        ServerAlias new.my_site
        DocumentRoot /home/my_user/jail/ramdisk/my_site/

        ErrorLog /home/my_user/jail/logs/my_site_error_log
        CustomLog /home/my_user/jail/logs/my_site_access_log combined

        ScriptAlias /cgi-bin/ /home/my_user/jail/ramdisk/my_site/cgi-bin/
        SuexecUserGroup my_user my_user


                AllowOverride FileInfo AuthConfig Indexes Limit Options=Indexes,FollowSymLinks

                Options +MultiViews +Indexes +SymLinksIfOwnerMatch +IncludesNoExec +FollowSymLinks +ExecCGI

                Require all granted

                AddHandler php5-fastcgi .php
                Action php5-fastcgi /cgi-bin/php.fcgi


                AllowOverride None
                Options +FollowSymLinks
                Require all granted

I've tried the suPHP version as well, but cannot find the package in the Cloudlinux repo:

# yum install mod_suphp
Loaded plugins: dellsysid, fastestmirror, rhnplugin
This system is receiving updates from CLN.
Loading mirror speeds from cached hostfile
 * cloudlinux-x86_64-server-7:
 * epel:
No package mod_suphp available.
Error: Nothing to do



  • Page :
  • 1

There are no replies made for this post yet.
Be one of the first to reply to this post!
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below. Supports gif,jpg,png,zip,rar,pdf
• Insert • Remove Upload Files (Maximum File Size: 2 MB)
To protect the site from bots and unauthorized scripts, we require that you enter the captcha codes below before posting your question.