LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > php.ini file not being read

Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2008, 12:54 PM
mwbarker mwbarker is offline
New Member
 
Join Date: Apr 2008
Posts: 5
Default php.ini file not being read

Just loaded Litespeed Standard and am trying to figure out why my php.ini file is not being loaded. The phpinfo.php file shows the right location, but the file still doesn't get loaded.

Configuration File (php.ini) Path = /home/myusername/configs
Loaded Configuration File = (none)

I added a file in the same directory called test.php with the following code in it:

<?php
$filename = "/home/myusername/configs/php.ini";
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
echo "$contents";
?>

It outputs the contents of php.ini just fine, so it does not appear to be a permissions issue. Anything else I can look at to try and find out why the config file is not being read, though?
Reply With Quote
  #2  
Old 04-08-2008, 02:20 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
You need to give "r" permission to "configs" directory in addition to "x".
Reply With Quote
  #3  
Old 04-08-2008, 02:50 PM
mwbarker mwbarker is offline
New Member
 
Join Date: Apr 2008
Posts: 5
It's already that way:

drwxr-xr-x
Reply With Quote
  #4  
Old 04-08-2008, 02:55 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
try command from command line

cd lsws/fcgi-bin
sudo -u <user_name> ./lsphp5 -i

user_name is the user that lsphp run as. "./lsphp5" should match your lsphp binary.

If it show the same value as your phpinfo() output, try

sudo -u <user_name> strace ./lsphp5 -i

you should be able to figure out what is wrong.
Reply With Quote
  #5  
Old 04-08-2008, 03:18 PM
mwbarker mwbarker is offline
New Member
 
Join Date: Apr 2008
Posts: 5
Man, I wish I could read that. I don't see anything that sticks out right at me. This is what I do see:

---
write(1, "Configure Command", 17Configure Command) = 17
write(1, " => ", 4 => ) = 4
write(1, " \'./configure\' \'--prefix=/usr/l"..., 262 './configure' '--prefix=/usr/local/php5' '--with-litespeed' '--with-mysql' '--with-mysqli' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=..' '--with-png-dir=..' '--enable-mbstring' '--with-imagick' '--with-config-file-path=/home/myuser/configs') = 262
write(1, "\n", 1
)
---

---
write(1, "Configuration File (php.ini) Pat"..., 33Configuration File (php.ini) Path) = 33
write(1, " => ", 4 => ) = 4
write(1, "/home/myuser/configs", 22/home/myuser/configs) = 22
write(1, "\n", 1
)
write(1, "Loaded Configuration File", 25Loaded Configuration File) = 25
write(1, " => ", 4 => ) = 4
write(1, "(none)", 6(none)) = 6
write(1, "\n", 1
)
---

---
access("/usr/local/lsws/fcgi-bin/lsphp", X_OK) = 0
open("./php-litespeed.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lsws/fcgi-bin/php-litespeed.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/php5/lib/php-litespeed.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lsws/fcgi-bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/php5/lib/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
---

Any ideas? It looks to me like it is looking all over for this file, but not finding it. Only problem is that there doesn't seem to be anything showing that it is actually looking where it is supposed to look.

Last edited by mwbarker; 04-08-2008 at 03:19 PM.. Reason: ...
Reply With Quote
  #6  
Old 04-08-2008, 03:25 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
It does not even look at that directory, I guess you need to rebuild your PHP binary, make sure to do "make clean".
Reply With Quote
  #7  
Old 04-08-2008, 03:28 PM
mwbarker mwbarker is offline
New Member
 
Join Date: Apr 2008
Posts: 5
Hmmm....

Creating a symbolic link in /usr/local/lsws/fcgi-bin/php.ini pointing to /home/myuser/configs/php.ini fixed the issue for me. But I still don't see why after I compiled PHP to look in the right folder that it couldn't find it where it was at.
Reply With Quote
  #8  
Old 04-08-2008, 03:32 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
If you added the configuration file path option later, you need to rebuild PHP completely. Otherwise, PHP may still looking for configuration file in the old location while showing the new configuration parameter in the phpinfo() output.
Reply With Quote
  #9  
Old 04-08-2008, 04:16 PM
mwbarker mwbarker is offline
New Member
 
Join Date: Apr 2008
Posts: 5
Nope, I added the configuration file path at the time I built PHP. Maybe a rebuild is needed, but do you see any problems with just leaving the symbolic link in place?

After all, I am just now getting down to setting up my Virtual Hosts and don't want to have to change anything. I must say, I am very impressed with Litespeed so far.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:25 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.