cvs: peardoc /en/guide/users/installation checking.xml
| From: | Christian Weiske | Date: | Fri, 30 May 2008 05:59:08 +0000 |
| Subject: | cvs: peardoc /en/guide/users/installation checking.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-10803@lists.php.net to get a copy of this message | ||
cweiske Fri May 30 05:59:08 2008 UTC
Modified files:
/peardoc/en/guide/users/installation checking.xml
Log:
Update 'check your pear installation' docs after chuck's and greg's comments
http://cvs.php.net/viewvc.cgi/peardoc/en/guide/users/installation/checking.xml?r1=1.1&r2=1.2&diff_format=u
Index: peardoc/en/guide/users/installation/checking.xml
diff -u peardoc/en/guide/users/installation/checking.xml:1.1
peardoc/en/guide/users/installation/checking.xml:1.2
--- peardoc/en/guide/users/installation/checking.xml:1.1 Thu May 29 20:52:46 2008
+++ peardoc/en/guide/users/installation/checking.xml Fri May 30 05:59:07 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<!-- do not change this ID, or you'll break thousands of link in the web -->
<sect1 id="installation.checking">
<title>Checking if PEAR works</title>
@@ -49,83 +49,100 @@
<para>
To use PEAR and PEAR compatible packages in your applications,
you normally include them into your PHP scripts using
- <function>require_once</function>.
- This does only work when PEAR's <literal>php_dir</literal> is in PHP's
- include path.
+ <ulink
url="&url.php.manual.auto;require_once"><function>require_once</function></ulink>.
+ For this to work, PEAR's <literal>php_dir</literal> must be a
+ part of PHP's include path.
</para>
<orderedlist>
<listitem>
- <para>
- First, check where PEAR installs <filename>.php</filename> files:
- </para>
+ <para>
+ First, check where PEAR installs <filename>.php</filename> files:
+ </para>
- <screen>
+ <screen><![CDATA[
$ pear config-get php_dir
/usr/share/lib/php/
- </screen>
+ ]]></screen>
</listitem>
<listitem>
- <para>
- Now check PHP's include_path setting. On unix command line, execute
- </para>
-
- <screen><![CDATA[
-$ php -i|grep include_path
-include_path => .:/usr/share/lib/php/ => .:/usr/share/lib/php/
- ]]></screen>
-
- <para>
- On Windows you could either pipe the output into a file and inspect it,
- or use <command>more</command> and search for the setting:
- </para>
+ <para>
+ Now it's time to find which configuration file is used by
+ your PHP installation. On command line, execute:
+ </para>
+
+ <screen><![CDATA[
+$ php --ini
+Configuration File (php.ini) Path: /etc/php/cli-php5
+Loaded Configuration File: /etc/php/cli-php5/php.ini
+Scan for additional .ini files in: /etc/php/cli-php5/ext-active
+Additional .ini files parsed: /etc/php/cli-php5/ext-active/php_gtk2.ini,
+/etc/php/cli-php5/ext-active/xdebug.ini
+ ]]></screen>
+
+ <para>
+ To see which <filename>php.ini</filename> is used by PHP on your
+ web server, create a file with only <command>phpinfo();</command> in it
+ and load it in your browser.
+ </para>
- <screen><![CDATA[
-$ php -i|more
- ]]></screen>
+ </listitem>
+ <listitem>
- <para>
- To check the PHP's include_path in your web server, save a file
- with only <literal>phpinfo();</literal> in it. Open it in your browser
- and verify the setting.
- </para>
+ <para>
+ Now check PHP's
+ <ulink
url="&url.php.manual;ini.core.php#ini.include-path">include_path</ulink>
+ setting on command line:
+ </para>
+
+ <screen><![CDATA[
+php -c /path/to/php.ini -r 'echo get_include_path(),"\n"';
+ ]]></screen>
+
+ <para>
+ To check the PHP's include_path in your web server, save a file
+ with only <literal>phpinfo();</literal> in it. Open it in your browser
+ and verify the setting.
+ </para>
+
+ <para>
+ In every case, PEAR's <literal>php_dir</literal> should be in the
+ include path. If not, add it in your system's <filename>php.ini</filename>.
+ </para>
- <para>
- In every case, PEAR's <literal>bin_dir</literal> should be in the
- include path. If not, add it in your system's <filename>php.ini</filename>.
- </para>
</listitem>
<listitem>
- <para>
- Now that this is done, try including a file. Create a new
- <literal>.php</literal> file with the following contents:
- </para>
- <programlisting role="php"><![CDATA[
+ <para>
+ Now that this is done, try including a file. Create a new
+ <literal>.php</literal> file with the following contents:
+ </para>
+
+ <programlisting role="php"><![CDATA[
<?php
require_once 'System.php';
?>
-]]></programlisting>
+ ]]></programlisting>
- <para>
- <filename>System.php</filename> is shipped with every PEAR installation
- and thus should be on your computer, too.
- Open the file with the browser from your web server, and also try
- it on command line. There should be no output.
- A message like:
- </para>
+ <para>
+ <filename>System.php</filename> is shipped with every PEAR installation
+ and thus should be on your computer, too.
+ Open the file with the browser from your web server, and also try
+ it on command line. There should be no output.
+ A message like:
+ </para>
- <screen><![CDATA[
+ <screen><![CDATA[
Warning: require_once(System.php): failed to open stream:
No such file or directory in /path/to/test.php on line 2
- ]]></screen>
+ ]]></screen>
- <para>
- means that your include path is not correct.
- </para>
+ <para>
+ means that your include path is not correct.
+ </para>
</listitem>
</orderedlist>
@@ -167,6 +184,17 @@
</para>
</listitem>
+ <listitem>
+ <para>
+ You cannot get away with using absolute paths in your own
+ <function>require_once</function> statements as an
+ altervative to fixing your <literal>include_path</literal>,
+ because all the other files that are then required by your scripts
+ are all coded for relative pathing based on
+ <literal>include_path</literal>.
+ </para>
+ </listitem>
+
</itemizedlist>
</sect3>