Help needed, new installation, things don"t work anymore.

Help needed, new installation, things don"t work anymore.

am 11.01.2008 08:56:54 von coolsti

Hope someone can help, I cannot figure out what is going on.

I have applications running on a Centos 3.3 Linux machine using php
version 4.3.2-26 with apache version 2.0.46-54. I have it set up so that
all my php scripts are located away from the apache document
tree, and I use php require statements to read them in when needed. I
have done nothing special to set this up. I did set up /etc/php.ini to
set its auto_prepend_file to a file located also away from the
document tree.

Several months ago I set up a new machine using Centos 4.5, which uses
slightly newer apache and PHP versions, but PHP was still in the 4.3
something range, not PHP 5. I had no problems getting this machine up and
running just like my old machine.

Due to a hardisk failure on that machine, I had to do the excersize again
recently, installing Centos 4.5 and trying to get my php application up
and running. But something must have changed in the past months or I am
missing something. This is the problem:

I cannot get PHP and to read in my php scripts located away from the
document tree. I get "failed to open stream: Permission denied in ..."
and Fata error: Failed opening required 'myfilename here' (include
path='.:/usr/share/pear) error messages.

I tried to adjust my /etc/php.ini file to add the directories where my
scripts are located to the include_path directive but this seems to be
ignored. I then noticed that my auto_prepend_file is also being ignored.
So it seems as if /etc/php.ini is not the php initialization
file that is being used when I reastart my httpd.

Can someone help me? What am I missing here? If /etc/php.ini is not the
ini file for php I should be using, what is? And why suddenly can I not
get PHP to read in files that I have located away from the document tree?
This was no problem before.

Some info: on the centos 4.5 machine, php version is 4.3.9-3.22.9

Thanks for any help!
Steve, Denmark

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 09:38:42 von coolsti

I just did some quick additional tests and I can see that it does not
appear as if my php.ini file is being used when I restart the httpd
daemon. I made a short script that calls phpinfo() so I can see the
settings in my browser. When I change a value in /etc/php.ini, and restart
httpd with /etc/init.d/httpd restart, and call my script, I see that the
values in /etc/php.ini which I changed were not accepted.

This tells me that the apache server on startup is not using /etc/php.ini
for some reason. But when I do "locate php.ini" (with an updated file
location database), this is the only php.ini on the machine!

So I seem to have two problems: /etc/php.ini is ignored, and I cannot read
my php scripts located away from the document tree.

Steve, Denmark

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 13:38:38 von Jerry Stuckle

coolsti wrote:
> I just did some quick additional tests and I can see that it does not
> appear as if my php.ini file is being used when I restart the httpd
> daemon. I made a short script that calls phpinfo() so I can see the
> settings in my browser. When I change a value in /etc/php.ini, and restart
> httpd with /etc/init.d/httpd restart, and call my script, I see that the
> values in /etc/php.ini which I changed were not accepted.
>
> This tells me that the apache server on startup is not using /etc/php.ini
> for some reason. But when I do "locate php.ini" (with an updated file
> location database), this is the only php.ini on the machine!
>
> So I seem to have two problems: /etc/php.ini is ignored, and I cannot read
> my php scripts located away from the document tree.
>
> Steve, Denmark
>

What configuration file does phpinfo() say it's using?

"Permission denied" indicates the webserver user does not have
permission to access the file. Correct your file system security.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 13:56:54 von coolsti

On Fri, 11 Jan 2008 07:38:38 -0500, Jerry Stuckle wrote:

> What configuration file does phpinfo() say it's using?
>
> "Permission denied" indicates the webserver user does not have
> permission to access the file. Correct your file system security.

Yes, that is the strange thing. It says it is using /etc/php.ini

So I don't understand what is happening.

Steve, Denmark

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 15:06:04 von coolsti

On Fri, 11 Jan 2008 07:38:38 -0500, Jerry Stuckle wrote:

> "Permission denied" indicates the webserver user does not have
> permission to access the file. Correct your file system security.

Yes, it certainly seems that this may be a solution to the problem. Could
you please tell me how to do that in this case?

Let me repeat: I set up this computer a few months ago and everything
worked. I set it up with a new hardisk last week and suddenly I have this
completely new security problem that I did not have before? If this is the
case, it is because I am missing something (I did something last time that
I don't really know about and didn't do this time) or there has been a
change in apache, the OS or PHP in the last few months.

So how do I go about fixing up the file system security for this problem?

Steve, Denmark

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 15:49:13 von Jerry Stuckle

coolsti wrote:
> On Fri, 11 Jan 2008 07:38:38 -0500, Jerry Stuckle wrote:
>
>> "Permission denied" indicates the webserver user does not have
>> permission to access the file. Correct your file system security.
>
> Yes, it certainly seems that this may be a solution to the problem. Could
> you please tell me how to do that in this case?
>
> Let me repeat: I set up this computer a few months ago and everything
> worked. I set it up with a new hardisk last week and suddenly I have this
> completely new security problem that I did not have before? If this is the
> case, it is because I am missing something (I did something last time that
> I don't really know about and didn't do this time) or there has been a
> change in apache, the OS or PHP in the last few months.
>
> So how do I go about fixing up the file system security for this problem?
>
> Steve, Denmark
>

Try one of the Linux admin support groups. They can walk you through
it. It's not a PHP problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 15:49:52 von Jerry Stuckle

coolsti wrote:
> On Fri, 11 Jan 2008 07:38:38 -0500, Jerry Stuckle wrote:
>
>> What configuration file does phpinfo() say it's using?
>>
>> "Permission denied" indicates the webserver user does not have
>> permission to access the file. Correct your file system security.
>
> Yes, that is the strange thing. It says it is using /etc/php.ini
>
> So I don't understand what is happening.
>
> Steve, Denmark
>

If the other files have permission problems, perhaps the php.ini file
does, also.

You need a linux admin support group to check out file permissions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 15:57:36 von coolsti

On Fri, 11 Jan 2008 09:49:13 -0500, Jerry Stuckle wrote:


> Try one of the Linux admin support groups. They can walk you through
> it. It's not a PHP problem.

Fair enough. Then in order me to be able to debug this very suddenly
occurring problem, let us keep this to PHP questions.

The answer to this would help me greatly with this problem:

If I restart my apache server and the php.ini file cannot be read, let us
say for example because of file permission problems, how can I see this?
Is there a log that will tell me this? How can I know that there is a
problem reading the php.ini file?

Steve, Denmark

Re: Help needed, new installation, things don"t work anymore.

am 11.01.2008 16:06:42 von Jerry Stuckle

coolsti wrote:
> On Fri, 11 Jan 2008 09:49:13 -0500, Jerry Stuckle wrote:
>
>
>> Try one of the Linux admin support groups. They can walk you through
>> it. It's not a PHP problem.
>
> Fair enough. Then in order me to be able to debug this very suddenly
> occurring problem, let us keep this to PHP questions.
>
> The answer to this would help me greatly with this problem:
>
> If I restart my apache server and the php.ini file cannot be read, let us
> say for example because of file permission problems, how can I see this?
> Is there a log that will tell me this? How can I know that there is a
> problem reading the php.ini file?
>
> Steve, Denmark
>

I don't know if you can. Check your Apache error log and see if there's
anything there.

Remember that if PHP cannot find a php.ini file, it will use default
values. So if phpinfo() says it's using /etc/php.ini and you edited
that file, about the only thing remaining is a permission problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Help needed, new installation, things don"t work anymore.

am 13.01.2008 16:26:42 von coolsti

On Fri, 11 Jan 2008 10:06:42 -0500, Jerry Stuckle wrote:


> I don't know if you can. Check your Apache error log and see if there's
> anything there.
>
> Remember that if PHP cannot find a php.ini file, it will use default
> values. So if phpinfo() says it's using /etc/php.ini and you edited
> that file, about the only thing remaining is a permission problem.

Many thanks to all repliers for the help so far. I found out that I can
indeed look in my /var/log/messages file and see an error message after
restarting the httpd daemon that states my php.ini could not be read due
to permissions. So the information is there, in the messages log, that
clearly points out the problem is a permissions one.

I believe my difficulty is due to SELinux. In my haste to reinstall this
machine after the hardisk failure I did not request that SELinux be
deactivated. I normally do this. I will know tomorrow for certain when I
go to work again, as I will deactivate SELinux and see if my php.ini can
be read. I believe this will solve my problems.

Regards,
Steve, Denmark