Patch for PEAR with UAC

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Patch for PEAR with UAC

Postby Wernight » 29. November 2011 23:55

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"
  ...
Last edited by Wernight on 30. November 2011 00:27, edited 2 times in total.
User avatar
Wernight
 
Posts: 6
Joined: 18. June 2007 14:23
Location: France/Hong Kong
Operating System: Windows 7 x64

Re: Patch for PEAR with UAC

Postby Sharley » 30. November 2011 00:14

Please add your XAMPP version and OS details to your profile:
viewtopic.php?f=16&t=48626
Thanks. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Patch for PEAR with UAC

Postby Wernight » 30. November 2011 00:24

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
User avatar
Wernight
 
Posts: 6
Joined: 18. June 2007 14:23
Location: France/Hong Kong
Operating System: Windows 7 x64

Re: Patch for PEAR with UAC

Postby Wernight » 30. November 2011 00:29

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.
User avatar
Wernight
 
Posts: 6
Joined: 18. June 2007 14:23
Location: France/Hong Kong
Operating System: Windows 7 x64

Re: Patch for PEAR with UAC

Postby Altrea » 30. November 2011 13:18

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).
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 121 guests