Permissions and PHP-Pear

Ask your questions regarding TimeTrex installation here.
Locked
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Permissions and PHP-Pear

Post by reloded »

Hi there.
My system is SME Server (CentOS). I have upgraded PHP and MYSQL to meet TimeTrex requirements. I downloaded the .zip and unzip it to my webroot. however, I get the following error.
/home/e-smith/files/ibays/Primary/html/timetrex2/interface/install/../../templates_c is NOT writable by your web server! For help on this topic click here.

PHP's PEAR package is not installed. TimeTrex requires PEAR to be installed.
On most Linux distributions installing the php-pear package is enough.

Your web server is unable to create directories inside of: /home/e-smith/files/ibays/Primary/html/timetrex2/interface/install/../../templates_c, please give your webserver write permissions to this directory. For help on this topic click here.
The folder being refered to is not even in the install directory.
timetrex2/interface/install/../../templates_c


I have checked php-pear $ rpm -qi php-pear
I get:
Name : php-pear Relocations: (not relocatable)
Version : 1.4.11 Vendor: CentOS
Release : 1.el4s1.1 Build Date: Sat 17 Feb 2007 02:36:26 PM EAT
Install Date: Tue 14 Aug 2007 10:57:15 AM EAT Build Host: build-i386
Group : System Source RPM: php-pear-1.4.11-1.el4s1.1.src.rpm
Size : 1922198 License: The PHP License v3.0
Signature : DSA/SHA1, Sat 17 Feb 2007 03:30:16 PM EAT, Key ID a53d0bab443e1821
Packager : Johnny Hughes <johnny@centos.org>
URL : http://pear.php.net/package/PEAR
Summary : PHP Extension and Application Repository framework
Description :
PEAR is a framework and distribution system for reusable PHP
components. This package contains the basic PEAR components.
Permissions, I even ran the following command to change all permissions for the directory.

Code: Select all

find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;
But I still get the error above.

Please assist.

Thank you.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

timetrex2/interface/install/../../templates_c
is the same as:

timetrex2/templates_c

Make sure that directory exists and is writable by your web server.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Thanks shaunw

I've confirmed. Its, there, It exists. However now, how do I check permissions that my web server has got write permission? I had used the following command to change all permissions.
find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;
How do I confirm? Better yet, how do I make sure it works?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Try the installation process again, if it doesn't complain, then its working.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi people.
I sorted out my permission issues. Changed permissions for the templates_c directory.

php-pear error persists though;
PHP's PEAR package is not installed. TimeTrex requires PEAR to be installed.
On most Linux distributions installing the php-pear package is enough.

For installation support, please join our community forums or contact a TimeTrex support expert for Implementation Support Services.
I've checked its installation and it is installed
[root@vassrv install]# rpm -qi php-pear
Name : php-pear Relocations: (not relocatable)
Version : 1.4.11 Vendor: CentOS
Release : 1.el4s1.1 Build Date: Sat 17 Feb 2007 02:36:26 PM EAT
Install Date: Wed 22 Aug 2007 12:22:33 PM EAT Build Host: build-i386
Group : System Source RPM: php-pear-1.4.11-1.el4s1.1.src.rpm
Size : 1922198 License: The PHP License v3.0
Signature : DSA/SHA1, Sat 17 Feb 2007 03:30:16 PM EAT, Key ID a53d0bab443e1821
Packager : Johnny Hughes <johnny@centos.org>
URL : http://pear.php.net/package/PEAR
Summary : PHP Extension and Application Repository framework
Description :
PEAR is a framework and distribution system for reusable PHP
components. This package contains the basic PEAR components.
I've changed my /etc/php.ini and set it to:
include_path = ".:/usr/share/pear/"
However, that does not resolve anything. I get the same error

Please assist.
Thanks
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Does this file exist:

/usr/share/pear/PEAR.php

If not, where is PEAR.php located on your system?
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Yes. the file PEAR.php exists and is located in the /usr/share/pear/ directory.
[root@server ~]# locate PEAR.php
/usr/share/pear/PEAR.php
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

For some reason PHP can't find or read your PEAR.php file.

So chances are its one of these issues:

1. /etc/php.ini isn't the correct php.ini file

2. the include_path in php.ini is incorrect or not properly set.

3. /usr/share/pear/PEAR.php doesn't actually exist. (should use ls -l instead of locate to make sure, since your locate database can be out of date)

4. The user that your web server runs as doesn't have permissions to read /usr/share/pear/PEAR.php
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi.
This is what I found regarding the possible causes:
1. /etc/php.ini isn't the correct php.ini file
phpinfo() gives the following output
Configuration File (php.ini) Path /etc/php.ini
2. the include_path in php.ini is incorrect or not properly set.
include_path = include_path = ".:/usr/share/pear/"

my phpinfo() shows:

Directive..............Local Value..........Master Value

include_path .:/usr/share/pear/ .:/usr/share/pear/
3. /usr/share/pear/PEAR.php doesn't actually exist. (should use ls -l instead of locate to make sure, since your locate database can be out of date)
[root@vassrv ~]# ls -l /usr/share/pear/PEAR.php
-rw-r--r-- 1 root root 34266 Feb 17 2007 /usr/share/pear/PEAR.php
4. The user that your web server runs as doesn't have permissions to read /usr/share/pear/PEAR.php.
I changed permissions for PEAR.php
[root@vassrv ~]# ls -l /usr/share/pear/PEAR.php
-rwxrwxrwx 1 apache apache 34266 Feb 17 2007 /usr/share/pear/PEAR.php
After doing that, the error is still there and I cannot proceed.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Create a file like: test.php that contains the following:

Code: Select all

<?php
require('PEAR.php');
exit;
?>
the run: php test.php

Does it fail and give you an error?

As well are you using ACLs or any other "high" security settings in CentOS? Those can often cause odd problems like this.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Well, I created the file and I ran the php script and it does not give an error. It goes through clean without any message

As for the ACL, am using the default installation of SMEserver (centos 4.5). They are not that crazy on security -I think :?
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

As we are troubleshooting this, I did a VM of ubuntu server (fiesty fawn). I installed timetrex there and everything went through -a few hurdles here and there but in the end, it went rather cleanly. Am now on company configurations etc.

Installing an Ubuntu Virtual machine was for my own comfort. At least I now know the pear problem here is not as a result of any newbieness to linux! :wink:

I'd like to get timetrex to work on smeserver though as my production machine is a smeserver.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Code: Select all

<?php
if ( include('PEAR.php') ) {
        echo "PEAR Success!\n";
} else {
        echo "PEAR Failed!\n";
}
exit;
?>
That previous code example wasn't very good, because it depended on several other .ini settings to actually write the error to the screen. Try this test.php script instead.

If it works from the shell, try putting it in your web root directory and loading it with a web browser to see if it works that way too.
reloded
Posts: 52
Joined: Mon Aug 13, 2007 10:24 pm

Post by reloded »

Hi.
Did as you asked. This is the output:
[root@vassrv html]# php test.php
PEAR Success!
But from the web browser, I get:
PEAR Failed!
Interesting. So.......?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

That means your PHP CLI (command line interface) is using a different .ini file then your Apache.

Code: Select all

<?php
phpinfo();
?>
Make a .php file with just that code in it, and load it in your browser, that will tell you which php.ini Apache is using. Then make sure the include path in that file match that of your CLI php.ini file.

Re-run the PEAR test script until it succeeds.
Locked