Page 1 of 1

Patch for PEAR with UAC

PostPosted: 29. November 2011 23:55
by Wernight
PEAR (of XAMPP Lite) tries to write in C:\Windows\PEAR.ini, showing the message:

PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed (fopen(C:\Windows\pear.ini): failed to open stream: Permission denied)


To keep it working by default without requiring this, here is a simple patch. Edit the file xampp\php\pear.bat and add the lines marked with a '+' (without the plus):

Code: Select all
  ...
  REM Check PEAR global ENV, set them if they do not exist
+ IF "%PHP_PEAR_SYSCONF_DIR%"=="" SET "PHP_PEAR_SYSCONF_DIR=%~d0\xampp\php"
  IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=\xampp\php\pear"
+ IF "%PHP_PEAR_DOC_DIR%"=="" SET "PHP_PEAR_DOC_DIR=%~d0\xampp\php\docs"
  IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=\xampp\php"
+ IF "%PHP_PEAR_DATA_DIR%"=="" SET "PHP_PEAR_DATA_DIR=%~d0\xampp\php\data"
  IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=\xampp\php\.\php.exe"
+ IF "%PHP_PEAR_TEST_DIR%"=="" SET "PHP_PEAR_TEST_DIR=%~d0\xampp\php\tests"
  ...

Re: Patch for PEAR with UAC

PostPosted: 30. November 2011 00:14
by Sharley
Please add your XAMPP version and OS details to your profile:
viewtopic.php?f=16&t=48626
Thanks. :)

Re: Patch for PEAR with UAC

PostPosted: 30. November 2011 00:24
by Wernight
Sharley wrote:Please add your XAMPP version and OS details to your profile:
http://community.apachefriends.org/f/viewtopic.php?f=16&t=48626
Thanks. :)


Done

Re: Patch for PEAR with UAC

PostPosted: 30. November 2011 00:29
by Wernight
Note: In php.ini the following doesn't seem to work:
Code: Select all
include_path = ".;\xampp\php\PEAR"

PHP requires an absolute path in order to work properly, so this should be fixed too:
Code: Select all
include_path = ".;X:\xampp\php\PEAR"

The best hack I found so far to do that, but it's not clean and won't work well if you have multiple XAMPP:
Code: Select all
include_path = ".;C:\xampp\php\PEAR;D:\xampp\php\PEAR;E:\xampp\php\PEAR;F:\xampp\php\PEAR;G:\xampp\php\PEAR;H:\xampp\php\PEAR;I:\xampp\php\PEAR;J:\xampp\php\PEAR;K:\xampp\php\PEAR;L:\xampp\php\PEAR;M:\xampp\php\PEAR;N:\xampp\php\PEAR;O:\xampp\php\PEAR;P:\xampp\php\PEAR;Q:\xampp\php\PEAR;R:\xampp\php\PEAR;S:\xampp\php\PEAR;T:\xampp\php\PEAR;U:\xampp\php\PEAR;V:\xampp\php\PEAR;W:\xampp\php\PEAR;X:\xampp\php\PEAR;Y:\xampp\php\PEAR;Z:\xampp\php\PEAR"


Yeah! Ugly, but at least portable without requiring to change the launcher (either PortableApps XAMPP Launcher or XAMPP-Lite launcher).

On my machine I've create a launcher that updates PHP.INI. The main reason is that the "\xampp" in php.ini doesn't work well for many things. For example opening sessions won't work properly telling that \xampp\tmp cannot be opened. Such launcher is pretty simple, and it's probably like XAMPP setup works.

Re: Patch for PEAR with UAC

PostPosted: 30. November 2011 13:18
by Altrea
or you use the xampp shell (included in the new XAMPP control panel v3).
This sets automatically local include paths for the shell to use the pear commands (and many other apache and mysql commands too).