Installing RAR extension in XAMPP?

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Installing RAR extension in XAMPP?

Postby MarcoScherer » 10. May 2017 13:03

Hi guys,

I'm driving mad while trying to install the RAR extension for PHP. I downloaded the RAR Module from PECL, compiled it and got a rar.so extension. I put this into the extension folder given with extension_dir in phpinfo(). In my case: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226. I even set the user rights to the "root" user, so the rights match all other extensions found in that folder.

Then I added entension=rar.so to PHP.INI and restarted Apache. No errors, all fine. To check that I edited the right PHP.INI file I changed the error_reporting option, which had an instant effect. So the edited PHP.INI is the right one. But RAR is still not listed in phpinfo() and using one of those commands:

Code: Select all
$rar_arch = RarArchive::open($folder.'/'.$file);
$rar_file = rar_open($folder.'/'.$file) or die("Can't open Rar archive");

always results in an error (class not found or function not found).

Although searching for solutions in Google brings up loads of entries, but nothing of help. Does anyone have a clue what to do?

Thanks,
Marco
MarcoScherer
 
Posts: 2
Joined: 10. May 2017 12:55
XAMPP version: 5.6.30-0
Operating System: Mac OS X 10.11.6

Re: Installing RAR extension in XAMPP?

Postby Nobbie » 10. May 2017 21:19

MarcoScherer wrote:compiled it


How and where and in which environment did you compile it? You cannot simply compile a module somehow and somewhere and move it to Xampp, it has to fit into the Xampp system. Xampp is not mentioned to be extended by user modules, i am not sure if there is any way to add extensions to Xampp. Xampp is meant for easy one click installation, but you cannot change a lot. If you like to have your own environment, do not use Xampp, install Apache etc. from your OS provider (i.e. Apple or similar, i am sorry, i do not have an OSX installation).
Nobbie
 
Posts: 9760
Joined: 09. March 2008 13:04

Re: Installing RAR extension in XAMPP?

Postby MarcoScherer » 11. May 2017 07:38

Hi Nobbie,

I followed these instructions: http://de2.php.net/manual/de/rar.installation.php. Basically I just downloaded the package and entered

Code: Select all
phpize
./configure && make && make install

in the Terminal, which resulted in the rar.so extension.

But if it's true that XAMPP cannot be expanded, that could be the problem. Although I didn't alter XAMPP, but the PHP.INI only.
MarcoScherer
 
Posts: 2
Joined: 10. May 2017 12:55
XAMPP version: 5.6.30-0
Operating System: Mac OS X 10.11.6

Re: Installing RAR extension in XAMPP?

Postby Nobbie » 11. May 2017 10:21

This "instruction" may work if you run PHP in CGI Mode (where php is run as standalone executable), you have to reconfigure Apache to do so. But usually Xampp is preconfigured to run PHP in "moduled mode" (as a dynamically loaded library), i dont think that you can build a new PHP module without integrating the Xampp development files (i.e. the include files and the libraries). Xampp comes with its own "phpize" etc., you have to build everything in the appropriate environment (i.e. you have to setup certain environment variables to point to the Xampp installation instead to any system folders, but i dont know which). As far as i remember, on linux there was a shell script a la "xampp_shell" or similar, you have to start this in a terminal and it automatically does the setup for the Xampp development environment. Maybe you will find a similar script within your OSX Xampp installation, unfortunately the pathnames of an OSX installation differ from the pathnames of a Linux installation. If there is such a script, start it via "./xampp_shell" (or whatever it is called) and wait for the prompt (maybe like "Xampp>" or so). And then again run your phpize, configure and make steps. Maybe you are lucky...
Nobbie
 
Posts: 9760
Joined: 09. March 2008 13:04


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 8 guests