install script: version number appended to "php" in package names, broken dependencies

I am building an install script for the new open source X2 CRM web application (and to eventually have it included in the standard distribution of Virtualmin Pro installation scripts). It depends on certain PHP modules, and requires PHP version 5. I use the following functions in the script:

sub script_x2crm_php_vers
return ( 5 );

sub script_x2crm_php_modules
return (“mysql”,“gd”,“mcrypt”,“pdo”,“pcre”,“soap”);

However, it produces the following error (for the module php-mcrypt):

Installing package php5-mcrypt …
Installing package(s) with command yum -y install php5-mcrypt …

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

I am using CentOS 6 x86_64, and this error is caused by, for instance, ‘php5-mcrypt’ not existing (although php-mcrypt does exist in that distribution of Linux). I’d like to make this script platform-independent, so if there’s anything I may be overlooking, please point me to the relevant documentation.


Well, the php5-mcrypt package doesn’t exist in CentOS 6, but it is available in CentOS 5.

So are you asking how to not require that package on certain versions of CentOS?


That would be useful and would solve the problem, although it (disabling requirements) would be a temporary solution. It seems as though Virtualmin should be able to determine the distro package name automatically (or does it, and are Virtualmin install scripts just not fully compatible with CentOS 6?)

Thank you.


Well, Virtualmin itself doesn’t know anything about the packages provided by distro… it’s up to the Install Script author to specify which packages need to be installed.

Unfortunately, CentOS 6 doesn’t have a PHP mcrypt package of any sort – that module isn’t provided in that distribution version.

If a script requires mcrypt, then it wouldn’t work on CentOS 6 unless the admin finds an alternative source for installing the mcrypt module… for example, the EPEL repository has an mcrypt module in it that would work.

So, if the app doesn’t require mcrypt, I’d recommend not including that as a requirement. If it does require it – then you could allow it to fail, and it would then be up to the user to find a way to install the module.



I’m still having this problem. It has absolutely nothing to do with mcrypt’s availability or lack thereof in CentOS 6.

The package names may differ between distributions of Linux; they differ between CentOS 5 and CentOS 6, the latter of which I am using. For instance, in CentOS 5 (and Debian/Ubuntu distributions) the package name is php5-pdo, whereas in 6 the package bears the version-agnostic name php-pdo.

Any word on when this issue will be resolved in the Virtualmin install script API, or hints on how I might be able to get distribution/package name info from within the script?