PHP Session Error?

We have an Opensuse 11.0 server running Apache, PHP and MySQL. We have several little gadget applications written in PHP that access that SQL database.

The PHP session files on my Opensuse 11.0/Apache server are created in /var/lib/php5. Something keeps changing the permssions on that folder (when the server is restarted?). The symptom is obvious: when we browse to one of our app pages, we get startup errors; the logs show “unable to create/access session file(s).” I’ll go in with SSH and sure enough, /var/lib/php5 will have changed to root/root ownership/group. I’ll change it back to apache/apache and everything will be fine.

Any ideas? What could be changing the ownership on that directory without my knowledge? I’ve done a quick grep through /etc and I’ve glanced at the cron jobs, but didn’t see anything obvious.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On my SLES 11 system I have wwwrun:root as the owners despite a few
reboots. I would suggest finding out what could possibly modify that on
your system… if you’ve setup any cron jobs, disable them for now. Any
startup scripts? Check them out too. You could potentially enable
filesystem auditing as well to see if it will catch the userid making the
change.

Good luck.

smpoole7 wrote:
> We have an Opensuse 11.0 server running Apache, PHP and MySQL. We have
> several little gadget applications written in PHP that access that SQL
> database.
>
> The PHP session files on my Opensuse 11.0/Apache server are created in
> /var/lib/php5. Something keeps changing the permssions on that folder
> (when the server is restarted?). The symptom is obvious: when we browse
> to one of our app pages, we get startup errors; the logs show “unable to
> create/access session file(s).” I’ll go in with SSH and sure enough,
> /var/lib/php5 will have changed to root/root ownership/group. I’ll
> change it back to apache/apache and everything will be fine.
>
> Any ideas? What could be changing the ownership on that directory
> without my knowledge? I’ve done a quick grep through /etc and I’ve
> glanced at the cron jobs, but didn’t see anything obvious.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ2ihyAAoJEF+XTK08PnB5YCsP/iWfUjOtoJgZAX7MchROl9FF
6IHkjKikfp0A4CfKYEvh7HF/+LcwDTb0d7wi/+I9l+istpY/RXng0gWFA8Zmk5JO
QvOxgiUjfF/I+UlCLwKBM/BF1KMY8JIfNjD/21kKGy2qL0ycYRM2z8gJVanSje/3
/LIShzMT4qb1ajtPjUKeL3sd9vsYEiRkjGOEPkOK2XCYzG1YrWAfprzoMnl6Bz7t
mHwbM1ByzpWFX3/VirTC+lVx5WOSGiJUyLbpnglqwm54F2cDlz5EFNaSZqvnG4b7
MzHSql44WHNFFc9/289sDvjLvYiam0LmA5NRv7hPgOO2+6NFvD3+kw50fel4zCrf
VDxyFP5w2T4q26ag5ZXWBz8SBkWdU+1n9l3NIBtHmyBBlvRzwPber7CUzQIdNY9B
Hw9mucQMd5V43ZtBWc+IbTAYR2SUw9wu3fQlII4yQgehFQM3FX4e4lymXVsT3jJk
zeUbLGersLtkbjvTp4DKcfbk7PKobey8i6V7gEgcYupRcv9k9pHT2tDsHrkHWse3
InPN0CpaJ/wqUHKC7f9fotDTmBFDhuW2yLS9Aa0gb32D+q3GRhXp/gCIq8/iae0D
Mafqnp6xcxN5NEnSXCkRkNADaOe/xJ7wiG+OgswrEpochATB13uizeIDjbeVPF0K
jNXcU9A3sAfhXTCV6M/F
=QRws
-----END PGP SIGNATURE-----

The only cron job is a simple rsync that does a nightly backup. As I mentioned above (but without details), I’ve looked through /etc/php5, etc/apache2 and at the startup scripts in init.d and haven’t found anything obvious.

I was hoping that someone here had experienced this and knew where a stray “chown” might have buried itself. Since it seems to be happening at reboot, I’m concentrating on boot and init scripts.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If it reliably happens on reboot does it also reliably happen on restart
of apache2? PHP doesn’t, afaik, have any scripts of its own that would be
involved.

Good luck.

smpoole7 wrote:
> ab@novell.com;1968993 Wrote:
>> On my SLES 11 system I have wwwrun:root as the owners despite a few
>> reboots. I would suggest finding out what could possibly modify that
>> on your system… if you’ve setup any cron jobs, disable them for now.
>
> The only cron job is a simple rsync that does a nightly backup. As I
> mentioned above (but without details), I’ve looked through /etc/php5,
> etc/apache2 and at the startup scripts in init.d and haven’t found
> anything obvious.
>
> I was hoping that someone here had experienced this and knew where a
> stray “chown” might have buried itself. Since it seems to be happening
> at reboot, I’m concentrating on boot and init scripts.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ2jV+AAoJEF+XTK08PnB5mf4QAKrqynHAHs8WL0FDl7mJ72ZA
B/4sg5VMgNJ6L2NPFyWfjK/1c6yn6MTRs76suh1aEzkth2qlCBJrps7yFLG2WtvU
KbyyiLi19CDQMM0gvoMQ0z/Cw0NuAX2T5IRRHBpfGydRKx6lqctkFT/3WLk/UrgO
ZcestsJTnLGtpuBwpXK1dVLBvRoPWIn0RSAa8W1fZzYqAGVY+jUiy/EXgZ2ueifW
/kvy7OXxBqrxZN781/e1pYbkwHIL5T6E5659vniqoTREehuB5zCbPlwJ1UfojqEA
HsNIvlMqK7BkC1oeYwA+r5oX4ta6tKM4hxFvYyPjTxpi2JfcO0ZLXWzOPfSOf1zn
gpPgDwxG1/rl7Bq5g1DMC4Qvp4Z9RaU/B/XqYLOGeMHT2hcVcx97Z9saeBYQqfy/
QsIyk+S64DvtBbpRSDkrJM4BfEDXrgq9LITnlE5qgWMkcefWzQMPOPMTK7RaebQW
ero3OVheW3JshFE2sxjSff9lttVSgXJbMDi1nVTjzzmVpJWdnQBe9OqUvyz3yjt+
YelK3RY/nGQhBGKex1vHKDPaGBBhQlrDkm1uBODbYeNN/UcdwqYzO85dD0GIJEin
CC4SmC8DVFYo26KalKM/MNEXvuwt6JyWTHLLkMDkfVk9yzgOcKfBa4HSa2ocnCmu
/bl38aUoPhQ5UKjSW8/S
=qgMp
-----END PGP SIGNATURE-----

Reboot this time didn’t do it, restart of Apache2 didn’t do it … but here’s a clue: we’re set up for automatic updates. The logs show that a PHP update was installed on 04-05. The problem appeared this morning. That may have been the cause.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

rpm -V <thePackageName>

for example

rpm -V php5

Post the output, please.

Good luck.

smpoole7 wrote:
> ab@novell.com;1969015 Wrote:
>> If it reliably happens on reboot does it also reliably happen on restart
>> of apache2? PHP doesn’t, afaik, have any scripts of its own that would
>> be involved.
>
> Reboot this time didn’t do it, restart of Apache2 didn’t do it … but
> here’s a clue: we’re set up for automatic updates. The logs show that a
> PHP update was installed on 04-05. The problem appeared this morning.
> That may have been the cause.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ2ktXAAoJEF+XTK08PnB5dt4QAMGyZNBQsuhhvEYDtN972X6z
SrZFH94uy2ImLfOglOwbO9znA0zrfjbTovgCNHZSZAG/28GCDAKEAGZWr7XhRMOV
oS4okEzANuEvbdnO/LbUIN+DkEoGkAY/DZFq6nSSpqZx/GXeM4+9e3U9XFPsY8vc
kwGQzHmic82FzWWOzpnW5I/nipnVyuD+366rn6wp6b+WRtJZCd6uwyiKDjuW6N3W
RiXkcI9ucdZexQNpDK2dcLXxFCUIYNmHl6Qm2HkHDEbaM2MBihaioCB0weJg8OD7
0rC+koCRlyGM6zN7AI3hsHZHc+g3mwKQ+MDRKaBCm8QF5xaXou3ocWlDE6P2wkNz
55Tb7T8bi74jbw+uHmIeLC6cQaekBXqVvfOOGEHMAcEgTHtCmD43wCLMwDeVY09p
x4GUIhI6i93h4ZZ//Yr5S5qhyYmDdXzohoojUI2xOoWF8LAOHg666n5qsbzwwFkq
OOEaIAa5NAIYVfGboVwURAS4euaTbJELiZvv0Q2SJmotOrEMudWfkoInXkPMwpbJ
L0+UweVZoO8YSSY2gtwHRn9vzhQ61NhruGmsf9qh4uG7dyPKBuihA89lUmiOZnOC
0F5/aN8tuSsymJ4rZJquMku35C3wV5Bz0GsMVhZKs0LRpHWps/G+lfsVoVlYO3mW
qRbSKV/HGeYqe1Pwt6rg
=IsWv
-----END PGP SIGNATURE-----

Heh, heh! Well, look at that:


www:~ # rpm -V php5
S.5....T  c /etc/php5/cli/php.ini
.M...UG.    /var/lib/php5

I solved my problem for now by simply inserting a cron job that resets ownership of /var/lib/php5 every morning at 1AM. Clunky and ugly, but it does the trick.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmmm… well at least we know it’s not the RPM (or at least not the
files/directories as stored in the RPM) but that doesn’t help us find what
is causing this, really. Oh well… I guess you can go from there but if
you find the root of the problem please let us know.

Good luck.

smpoole7 wrote:
> Heh, heh! Well, look at that:
>
>
> Code:
> --------------------
>
> www:~ # rpm -V php5
> S.5…T c /etc/php5/cli/php.ini
> .M…UG. /var/lib/php5
>
> --------------------
>
>
> I solved my problem for now by simply inserting a cron job that resets
> ownership of /var/lib/php5 every morning at 1AM. Clunky and ugly, but it
> does the trick.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ21/MAAoJEF+XTK08PnB5+58P/RYLiIDsDI7c1mv4/cXU5RIh
lUS1LewPmHQUkFKpdFVBj8HQWsHMNOHa20yl0kb6QlwR6GJcNy4JlIelDBSi8kyZ
AfbG0aEpfpm8PwQ07UAa3BV8bsuqLhnynMhdo3Rqwv5CNQsKpB+flVJxfhNBEC1l
nfibFiDparrvGsUuQ3+Q6VBf/P7N+iyWchXPhJs11n39CMP7ZI+RaMTiyih5cQU1
/k3+/jXCMMPZUuvXmCmwL7e7IBHCgp982ftle0DcsygeP4oauNa9NXwt+Wgq7Gt7
VK2qX1eX42TgCnRP8EnKKNVA9sgglGr4Ps0sHDrIcs+XapLH16/SM7Iu9y5hGEPF
cz0cE/iSQYLmnlwAFXWISOxz38+/1wmE04jVibanGrsJzNec3EFvIqZd4af55LII
/J27uAbdLHrP3mhiohUCNpQurEvB4qRL5tQbjeePK01kmnCK14/ETZgg0lAOZqzU
2N1eirDdVPG77mFNVgwsafkG7nyNH3q3XvAJK+2L0XvGya7Z7//aHwVcTCaZH4nJ
ogHNIhqs9GUo2W75Bx1eBg4YIEhhXBHqkeo4rXuNaq07Lei9N04W2Y93V2wAHBp2
7kc+xbF0ADDHnBvsDhVXi5812ny/XrCbfPhsX8jhKMepKnZK7k1Z1851qttj/5KL
u+nEsd6P6h7+Ny5fJ4px
=jBRf
-----END PGP SIGNATURE-----

Is it not in /etc/permission perhaps (Shrug) seems to be doing something with ownership.

Though I would of thought grep would of found it. Either way is not permissions the elegant way of solving(Shrug).

Just a random drive by posting, thinking aloud really.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, /etc/permissions stores some permissions, but I don’t think those are
changed with every load or even affect those systems. Also I don’t see
/var/lib/ntp in any of those files so probably not related to those.

Your post reminded me of the line from Mrs. Doubtfire… “…it was a
drive-by fruiting…”

Good luck.

FeatherMonkey wrote:
> Is it not in /etc/permission perhaps (Shrug) seems to be doing something
> with ownership.
>
> Though I would of thought grep would of found it. Either way is not
> permissions the elegant way of solving(Shrug).
>
> Just a random drive by posting, thinking aloud really.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ220aAAoJEF+XTK08PnB5o4MQAM4eyCKIlPja6ildOWXC3npC
s1g1P/SOIOFOC/sZdaESVOfO9aGDptp8A0FTJ+DgeWbxphNBBv/5WDSUCgQnvDsc
ccCNq1qfI+eAbfuaehqesqdqf1/HzvifBgG3+g7RfOlR8+SMLbw/d9bgLF3G1Voc
BO7h/6rUf8kBwosaZyFiTI337HlQci1baQ2I6feRelfKLP2RaISI/vvoZTtIYCWx
okQzIayor2tAfqJiPepWjzUwb8j2BWensFna75w0sERbfdGNw4eLODtKc0tXP0+t
tAowzAEZBu6Nzg42WegGV0YViCzk3hFDlc7OnxBRtljWsNmZZKdRMETvlz4k9yq9
pagrYmIVqmG7aFAUsSDTZuhzFNf0DZiKEVR8YE1GheP6bvAPLB1OB1dO7gU3pYCq
wYtA4rXd3Jvdc7CN40g3MftiCRGTbVf2X5fThlokWY8l4SsZ1yC6T/w92rdnLWrJ
pkLOcb+jI+Wb9LkelkrFJbHYudfDmUeGw5UqtukhLVvwjpcuUThN2lJMeXUQuYxK
3w+xbcmJyeXcCFqzEsvgR96v4AT5BbaKPMWMUulV2s1Q8qpPSyUj5Y13xf0uQhp2
GQqwhzN3wP/mcFeYRxpO1wE87ro4kFCG/y1mviI+EIcqIVtme414RSXdax7Jp9bq
M3CC1M5YbDfJQycdqF40
=a/X4
-----END PGP SIGNATURE-----

It seems to imply it is ran with SuseConfig as for at boot(I feel a shrug) like I said really don’t know and I’d trust grep here.

I never really did understand the role of /etc/permission.*

Well, wait a minute. I think it HAS been solved.

I’ll admit I’m not an expert on rpm at the CLI. I much prefer Yast because it takes care of the gnarly details for me, and I have more important things to worry about. :slight_smile:

But from looking at the man page, “rpm -V” means “verify” – i.e., compare the current state of the package files to those stored in the RPM. The response for “/var/lib/php5” specified “M, U and G” as different – mode, user and group. I think I did tinker with chmod while I was experimenting, so that explains the “M.”

Remember, I have changed the ownership and group on that directory to “apache.apache.” It was originally “root.root” right after the update. This tells me that the update IS the cause. It’s setting the permissions on that folder each time I update.

I’ve gone back through the logs, and the last time this problem appeared (that’s as far as my logs go), it was right after an update. So … I think this HAS been solved, at least to my satisfaction.

The more you add, points to permissions, permissions is run with Suseconfig which is run after update.

Me I would look into the permissions, I’m sure its related to this. But as said I’m presuming permissions is a fail-safe to check priority files for the correct permissions and changes them.

Otherwise I haven’t got a clue what permissions does.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I see… so you ran it when it was “right” according to you and wrong per
the RPM… I was under the mistaken impression you ran it when it was
still root:root so thank-you for clarifying that. Well that’s
interesting. Perhaps report a bug against the package, or else try SLES
11 which seems to be working for me so far.

Good luck.

smpoole7 wrote:
> ab@novell.com;1969516 Wrote:
>> Hmmm… well at least we know it’s not the RPM (or at least not the
>> files/directories as stored in the RPM)
>
> Well, wait a minute. I think it HAS been solved.
>
> I’ll admit I’m not an expert on rpm at the CLI. I much prefer Yast
> because it takes care of the gnarly details for me, and I have more
> important things to worry about. :slight_smile:
>
> But from looking at the man page, “rpm -V” means “verify” – i.e.,
> compare the current state of the package files to those stored in the
> RPM. The response for “/var/lib/php5” specified “M, U and G” as
> different – mode, user and group. I think I did tinker with chmod while
> I was experimenting, so that explains the “M.”
>
> Remember, I have changed the ownership and group on that directory to
> “apache.apache.” It was originally “root.root” right after the update.
> This tells me that the update IS the cause. It’s setting the
> permissions on that folder each time I update.
>
> I’ve gone back through the logs, and the last time this problem
> appeared (that’s as far as my logs go), it was right after an update. So
> … I think this HAS been solved, at least to my satisfaction.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ3J3nAAoJEF+XTK08PnB5QPUP/0d4Wq6GcFKvkYXMunkyPzsp
AjQ2LHuwlEniAVO5KJVmqqMElRse3GbXi3GbAcgqU19V+bVrRjSoyQ98kBabcTxD
BxJAgi0sxVCnXfFxj/37DMRmhMhBhlYcbX4GRXxZ8g/EXXi0SVHzb605o/aIdozs
dFGdTzmpmfUZBtNoo6bilnzwNbAsArVNMjhohuOHvmGeoI0f6hPMAxfR16EhVvQ5
9256b/fllXoVrXcB8d8D2o9t7pvgEmIEWH5attY9/qdOpDzntJng8A9ljw6ZJnBs
nyhu0PGwuxHPXArP7cl0wFE0XOIvUoSLGbhuKoL9/YhLwQeHrTpsNUKRkO2EnYsg
udqgDG4Ss6UpDHlLVwqoYXullcMgxIdvRbkhx512rqh1cNn1oWE5Z0ZTNR4dzXZg
Zi7wVcx+thn4iugkb3kfbggHfKsKawB0/7cCpLRInxn3eem2c2cEpd6mhISPdPYa
LyUhqvpOoYvgtX9JZkxo3gBAkaGbeoX1SfheuacaElKMO/1cbSVv8CoYjfP1OX0f
myWaJN4UrM11P8gbqSVcIPKIABub0/ugPluqOyH480IY66LxL1j1ZZzCZp4+4pfQ
bHI2eF6K9jklYWTD7f7UkAIAkotUAtlLyq8rI1ZyrK3pxC/UBdCyniQ2W5dri2BC
vFUiiEudoSsxztDcZAzP
=I759
-----END PGP SIGNATURE-----