12 Replies - 6411 Views - Last Post: 20 September 2012 - 12:35 AM Rate Topic: -----

#1 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Installing PEAR

Posted 15 September 2012 - 12:08 PM

Hope I'm in the right forum for this. I've been trying to figure out how to get PEAR installed, and I've been using the following instructions:

Quote

PEAR is not installed by default with the Windows distribution. To install it, you need to run the go-pear.bat file, located in the PHP distribution’s root directory.


There's a problem right away - I have no go-pear.bat file in my PHP root directory. Which for the record is "C:\php".

At first I tried looking for the go-pear.bat file online but couldn't find it. I did find one .phar file, which "Windows couldn't run" (I'm running on Windows 7 64-bit).

After that I tried following the Pyrus instructions:

Quote

If you’re running PHP 5.3.1 or newer, you’re encouraged to begin using Pyrus immediately. To begin
using it, download the pyrus.phar file from http://pear2.php.net/pyrus.phar. Once downloaded, you
can begin using Pyrus right away:
%>php pyrus.phar
The first time you use Pyrus, you’ll be prompted to specify where you’d like to store installed PEAR
packages.


It is worth noting that I am running "PHP 5.3.1 or newer". PHP 5.4.6 to be specific. So I tried downloading that, then I placed it in C:\pear and attempted to run it via the command prompt. Running .phar again seems to be the problem. The quoted instructions are instructions for Windows as well. Could any of you guys offer some advice on this?

Is This A Good Question/Topic? 0
  • +

Replies To: Installing PEAR

#2 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 15 September 2012 - 12:44 PM

@ECHO OFF
C:\php\php -dphar.readonly=0 -dopen_basedir= -dsafe_mode= C:\php\pyrus.phar %*


Tried using this - it tells me it can't find 'C:\php\php_mysqli.dll'. Most likely because it's in C:\php\ext. Is it safe for me to move the files in the ext directory to the php directory?
Was This Post Helpful? 0
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Installing PEAR

Posted 15 September 2012 - 01:19 PM

No don't do that. It'll just end up a mess if you start moving extension libraries around. Did you specify the extension_dir directive in the php.ini file? It's probably best to make it an absolute value.

By the way, have you considered setting this up on Linux instead? Things like this are usually much easier to deal with on Linux :)
I like having a Ubuntu server on a virtual host, that reads the www data from a directory that is shared with the Windows host, so that I can work like normally on Windows, but have the server running on Linux.
Was This Post Helpful? 2
  • +
  • -

#4 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 15 September 2012 - 03:24 PM

View PostAtli, on 15 September 2012 - 01:19 PM, said:

No don't do that. It'll just end up a mess if you start moving extension libraries around. Did you specify the extension_dir directive in the php.ini file? It's probably best to make it an absolute value.


Thanks, that did the trick. Had to uncomment the sqlite3 extension in php.ini afterwards as well though. Finally at the point where I get to select where I install the packages by default - even though I got an error at my first try. Will look into this properly tomorrow seeing as I woke up at 6 AM and am immensely tired. But thanks again :)

View PostAtli, on 15 September 2012 - 01:19 PM, said:

By the way, have you considered setting this up on Linux instead? Things like this are usually much easier to deal with on Linux :)
I like having a Ubuntu server on a virtual host, that reads the www data from a directory that is shared with the Windows host, so that I can work like normally on Windows, but have the server running on Linux.


Your set up sounds like something I'd want to try. If I'm clever enough to get that kind of thing going.
Was This Post Helpful? 0
  • +
  • -

#5 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 16 September 2012 - 01:12 AM

In case anyone looks at this who has the same problem, ever: The file permission thing is easily resolved by running cmd as administrator.
Was This Post Helpful? 0
  • +
  • -

#6 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 17 September 2012 - 12:00 PM

I have another question - I hope you don't mind. I'm attempting to include a package I downloaded from with Pyrus (from PEAR) in my script but am having a problem.

The location of my PEAR packages is: C:\php\php\

And here's how I attempted to include the package:
require_once 'C:\php\php\HTML\QuickForm2.php';
require_once 'C:\php\php\HTML\QuickForm2\Renderer.php';



And at last, my error:

Quote

Warning: require_once(HTML/QuickForm2/Container.php): failed to open stream: No such file or directory in C:\php\php\HTML\QuickForm2.php on line 49

Fatal error: require_once(): Failed opening required 'HTML/QuickForm2/Container.php' (include_path='.;C:\php\pear') in C:\php\php\HTML\QuickForm2.php on line 49


I tried looking into the php.ini file and searched for the word "pear".

I then found this:
"; PHP's default setting for include_path is "
.;/path/to/php/pear"
; http://php.net/include-path"

Should I change the .;/path/to/php/pear line to the path? For some reason it seems like it'd be more likely to mess things up than fix anything.

Pardon my questions, I find shockingly little about this on google.
Was This Post Helpful? 0
  • +
  • -

#7 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Installing PEAR

Posted 18 September 2012 - 04:56 AM

When you use absolute paths like that, the include_path shouldn't matter. It only matters if you use relative paths. (which is usually a better idea, for the sake of portability.)

Have you checked the file permissions? If you are running the PEAR script as admin, its possible that the files may be inaccessible to non admin users.

By the way. Why is the PEAR location named "/php/php"? Your include path contains "/php/pear". I'd have though that would be a more appropriate location.
Was This Post Helpful? 1
  • +
  • -

#8 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 18 September 2012 - 07:18 AM

View PostAtli, on 18 September 2012 - 04:56 AM, said:

When you use absolute paths like that, the include_path shouldn't matter. It only matters if you use relative paths. (which is usually a better idea, for the sake of portability.)


Yeah, I just noticed that. If I want to use absolute paths, I'll need to change pretty much every single require/include line in every single PHP script that the package includes.

View PostAtli, on 18 September 2012 - 04:56 AM, said:

By the way. Why is the PEAR location named "/php/php"? Your include path contains "/php/pear". I'd have though that would be a more appropriate location.


I was in a rush when I installed it originally, and I typed in: "C:\php". I've now changed the path to "C:\php\pear" with the following command:

php pyrus.phar mypear "C:\php\pear"



I then proceeded to re-install the HTML_QuickForm2 package and it was installed in that directory.

After which I attempt to include the package with the following lines (found in the book I'm reading, and the other scripts in the package):

require_once "HTML/QuickForm2.php";
require_once 'HTML/QuickForm2/Renderer.php';



This is the error I get when I run it:

Quote

Warning: require_once(HTML/QuickForm2.php): failed to open stream: No such file or directory in C:\apache\htdocs\Chapter 13\Pyrus_QuickForm2.php on line 6

Fatal error: require_once(): Failed opening required 'HTML/QuickForm2.php' (include_path='.;C:\php\pear') in C:\apache\htdocs\Chapter 13\Pyrus_QuickForm2.php on line 6


So it failed to open the required 'HTML/QuickForm2.php'.

The include_path seems to be set to C:\php\pear, which is my new directory.

Problem is, HTML\QuickForm2.php is under "C:\php\pear\php".

I have NO idea why it does that. I never add the second php to the path, it just seems to be a default setting.
Was This Post Helpful? 0
  • +
  • -

#9 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Installing PEAR

Posted 18 September 2012 - 06:20 PM

Odd. I have no idea why it'd do that either. But if Pyrus is somehow configured to use "/php/pear/php" then you may as well just update the include path to reflect that.

I'm assuming the absolute path to the QuickForm2.php file is now:
C:\php\pear\php\HTML\QuickForm2.php
Was This Post Helpful? 1
  • +
  • -

#10 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 19 September 2012 - 05:40 AM

View PostAtli, on 18 September 2012 - 06:20 PM, said:

Odd. I have no idea why it'd do that either. But if Pyrus is somehow configured to use "/php/pear/php" then you may as well just update the include path to reflect that.


Done. Have a new problem now however:

Quote

Warning: require_once(PEAR/Exception.php): failed to open stream: No such file or directory in C:\php\pear\php\HTML\QuickForm2\Exception.php on line 49

Fatal error: require_once(): Failed opening required 'PEAR/Exception.php' (include_path='C:\php\pear\php') in C:\php\pear\php\HTML\QuickForm2\Exception.php on line 49


And for the record, Exception.php is very much there. And it is located at "C:\php\pear\php\HTML\QuickForm2\Exception.php". I changed the include_path to "C:\php\pear\php" as you can see.

Quote

I'm assuming the absolute path to the QuickForm2.php file is now:
C:\php\pear\php\HTML\QuickForm2.php


Yeah, it is. This is getting fairly irritating as well - it won't do anything, even when referred to the right place. I appreciate your help though.
Was This Post Helpful? 0
  • +
  • -

#11 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 19 September 2012 - 05:47 AM

Forgot to add, this is what is written on line 49 in Exception.php:

require_once 'PEAR/Exception.php';


I assume that with my include_path being 'C:\php\pear\php" that this require line would be referring to "C:\php\pear\php\PEAR\Exception.php'.

In which case, there isn't any folder called "PEAR" located in there. I'm sorry for dragging you into this. Perhaps I should try re-installing this, if I can find out how. Or attempt to install regular PEAR instead.

This post has been edited by Tenderfoot: 19 September 2012 - 09:38 AM

Was This Post Helpful? 0
  • +
  • -

#12 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Installing PEAR

Posted 19 September 2012 - 01:57 PM

As far as I can tell, you actually have to install what used to be the "core" PEAR packages manually when you are using Pyrus. Normal dependency rules probably won't apply to them, so they may not be installed when installing PEAR packages:
php pyrus.phar install pear/PEAR



I tested that on Linux and it worked fine. Tried to do it on Windows as well, but after fixing like 5 different errors when trying to install anything on there, and still not getting it to work, I gave up on it. (For some reason it insists on trying to rename the base PHP directory... the one where the PHP executable is located.)
Was This Post Helpful? 1
  • +
  • -

#13 Tenderfoot  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 160
  • Joined: 21-March 12

Re: Installing PEAR

Posted 20 September 2012 - 12:35 AM

View PostAtli, on 19 September 2012 - 01:57 PM, said:

As far as I can tell, you actually have to install what used to be the "core" PEAR packages manually when you are using Pyrus. Normal dependency rules probably won't apply to them, so they may not be installed when installing PEAR packages:
php pyrus.phar install pear/PEAR



I tested that on Linux and it worked fine. Tried to do it on Windows as well, but after fixing like 5 different errors when trying to install anything on there, and still not getting it to work, I gave up on it. (For some reason it insists on trying to rename the base PHP directory... the one where the PHP executable is located.)


Yeah, I just tried using the pyrus.phar install pear/PEAR command, at first I got a permission error, and after that another. I think I might just give up on this until/unless I set Linux up on my computer. Annoys me a bit though seeing as the book I'm reading through has about 1-2 PEAR examples each chapter and I'm a bit of a perfectionist, really don't like it when I can't finish some part of something I'm doing. :whatsthat:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1