You are not logged in.
Pages: 1
I'm trying to run a php script I downloaded for web log file analysis. When I run it I am getting the following error:
[root@bacchus http]# ./statviz.php --config example.conf
Warning: main(Config.php): failed to open stream: No such file or directory in /home/chane/http/statviz.php on line 28
Fatal error: main(): Failed opening required 'Config.php' (include_path='.:/usr/share/pear') in /home/chane/http/statviz.php on line 28
I am running this as root and just to be sure have set all paths in /home... to be chmod 777.
Line 28 is:
require_once 'Config.php';
When I look in the /usr/share/pear directory there is not a file named Config.php. This file is located in .../pear/PEAR/Config.php.
I have tried to change the require to be PEAR/Config.php but that did not load it either.
My php install is vanilla via pacman. I am not a php expert so any suggestions as to how to fix this are much appreciated.
BTW: here is the script I am trying to run:
http://statviz.sourceforge.net/
Thanks in advance,
Chris....
Offline
it looks like you executed it from within your user public_html folder (although your folder is renamed).
Be aware that apache uses su_exec for php files executed in this folder. It will modify the permission structure for includes and file writing..
Try looking at the log file in /var/log/httpd/suexec_log
The file you try to include would have to have the same user (or group, depending on how you setup su_exec). It is similar to php safe mode, I believe..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
forgot to mention I am running this from the command line and not via a web server. In essence this program takes a file in and generates a file out. I just happened to have named the subdirectory http since the script is analyzing web log files.
Could I have the path setup incorrectly for php to be used from the command prompt?
Just reread your post and I will look further into php safe mode? Maybe that's it....
EDIT: safe mode is off in the php.ini file....
Chris....
Offline
maybe the PHP include paths need to be modified? just thinking outloud....
Offline
simple question - how do I change the php include path?
I'm willing to try anything....
Chris....
Offline
edit php.ini
; UNIX: "/path1:/path2"
include_path = ".:/php/includes:/usr/share/pear:/usr/share/pear/PEAR"
;
I am not sure why the pear in arch is layout as as it is..Maybe the pear packager knows..
EDIT: For some reason, it seems you need to include both the base pear dir, and PEAR dir in includes..
/usr/share/pear/Console
/usr/share/pear/Console/Getopt.php
These are not in the PEAR dir, but they are required by your script..
I altered the include accordingly.
EDIT2: Another solution. Just add this to the top of the php script..
<?php
ini_set("include_path",ini_get("include_path").":/usr/share/pear:/usr/share/pear/PEAR");
?>
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
I edited the php.ini file. Two interesting things:
First, the include_path was commented out. I found the interesting since the error message had a path in it (.:/usr/share/pear).
Second, I uncommented and made the path look like:
include_path=".:/usr/share/pear:/usr/share/pear/PEAR"
and I got this error:
FATAL: Config module required. Please install the PEAR module: Config
Offline
see my edits above. I later noticed that the base pear dir also had to be included..
as for the include path being commented out and still having a value. the initial string listed is the default value, meaning that is what it is set to if it is commented out. If you oncomment and CHANGE it, then it gets modified..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Catcus - thanks for your help.
Sometimes I dislike technology....
I tried both of your sugestions for modifying the import path and ended up with the following code:
#!/usr/bin/php -d output_buffering=0
<?php
ini_set("include_path",ini_get("include_path").":/usr/share/pear:/usr/share/pear/PEAR");
// constants
define('STATVIZ_CONF_TYPE', 'inifile');
// includes
require_once 'Console/Getopt.php';
require_once 'Config.php';
// check dependencies
if (!class_exists('Console_Getopt')) die('FATAL: Console_GetOpt module required. Please install the PEAR module: Console_GetOpt' . "n");
if (!class_exists('Config')) die('FATAL: Config module required. Please install the PEAR module: Config' . "n");
</snip>
When I run this I am hitting the second error message !class_exists('Config')....
Did you download this script and get it working on your box by chance?
Thanks for you help, I appreciate you taking the time to walk me through something that should be simple...
Chris....
Offline
I added:
ini_set("include_path",ini_get("include_path").":/usr/share/pear/PEAR");
to the script right before the
define('STATVIZ_CONF_TYPE', 'inifile');
section
Then I had to install Config for PEAR...
prompt$ sudo pear install Config
then running the script worked fine.
I think the files in /usr/share/pear are just for using pear itself (ie installing pear elements). Whereas the files in /usr/share/pear/PEAR are the files used by php scripts, hence, that dir should be the one in the include, and not the base pear dir..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Catcus -
A big thank you.
The last trick of installing Config was what I was missing.
Thanks again!
Chris....
Offline
np.
glad to get you working..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Pages: 1