Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpinfo() give me segmentation fault #1

Closed
jjone opened this issue Feb 22, 2015 · 10 comments
Closed

phpinfo() give me segmentation fault #1

jjone opened this issue Feb 22, 2015 · 10 comments

Comments

@jjone
Copy link

jjone commented Feb 22, 2015

HI, Whissi

After installing turbo_realpath, phpinfo() gives me segmentation fault
my system is centos 7, php 5.4.16. Is this compatible with centos 7, php 5.4.16 ?
thank you very much for your help.

Justin

@Whissi
Copy link
Owner

Whissi commented Feb 22, 2015

Hello Justin. I just checked PHP 5.4.38 with turbo_realpath v1.3 and it is working fine for me.
I didn't tried CentOS (I am using Gentoo) but I expect that your PHP is crashing for another reason, not realpath_turbo related.

  • Is your installation really working and only crashing when you add

    extension=turbo_realpath.so

    (=not crashing without this line)?

  • You are using realpath_turbo v1.3, aren't you?

@jjone
Copy link
Author

jjone commented Feb 22, 2015

Hi, Thomas
Very strange. I commented out this extension then my phpinfo() works with no segmentation fault. I installed turbo_realpath by following your github install guide but I will double check my php setting again later on.
again, thank you very much for your time and help.
justin

Sent from Acompli

_____________________________

From: Thomas D. [email protected]
Sent: Sunday, February 22, 2015 4:43 PM
Subject: Re: [realpath_turbo] phpinfo() give me segmentation fault (#1)
To: Whissi/realpath_turbo [email protected]
Cc: jjone [email protected]

Hello Justin. I just checked PHP 5.4.38 with turbo_realpath v1.3 and it is working fine for me.
I didn't tried CentOS (I am using Gentoo) but I expect that your PHP is crashing for another reason, not realpath_turbo related.

Is your installation really working and only crashing when you add extension=turbo_realpath.so

(=not crashing without this line)?

You are using realpath_turbo v1.3, aren't you?


Reply to this email directly or view it on GitHub.

@jjone
Copy link
Author

jjone commented Feb 22, 2015

Hi, Thomas

my /etc/php.d/turbo_realpath.ini

extension=turbo_realpath.so
realpath_cache_security = 1
realpath_cache_basedir = ""
open_basedir = ""

when i run php -i
here is the output :

Turbo Real Path => enabled
Description => Solves performance problems with PHP applications and NFS storage
Extension version => 1.3
RealPath basedir path =>
RealPath safe mode =>
RealPath basedir security => Segmentation fault

i think RealPath basedir security is giving me the problem. i want set open_basedir to none.
i don't know if it was set correctly in my turbo_realpath.ini.

Thank you very much.

Jusitn

@Whissi
Copy link
Owner

Whissi commented Feb 22, 2015

OK, I was able to reproduce your problem:
Remove realpath_cache_security option for the moment or set to 0. Seems like this option is causing problems (I don't use this option, instead I use disable_functions).

Will see if I can fix that...

@jjone
Copy link
Author

jjone commented Feb 22, 2015

Hi, Thomas

I set it to 0 and it works nicely.

one more issue, i checked my realpath cache with this php function, var_dump(realpath_cache_size()); var_dump(realpath_cache_get()); the 1st time output looks good. it give me a list of cached directory links.

However, here is the 2nd time and next time output from my php-fpm dedicated server,

int(221) array(3) { ["/etc"]=> array(4) { ["key"]=> float(1.6714350287265E+19) ["is_dir"]=> bool(true) ["realpath"]=> string(4) "/etc" ["expires"]=> int(1424647280) } ["/etc/php.d"]=> array(4) { ["key"]=> float(1.6027146195387E+19) ["is_dir"]=> bool(true) ["realpath"]=> string(10) "/etc/php.d" ["expires"]=> int(1424647280) } ["/etc/php.d/opcache-default.blacklist"]=> array(4) { ["key"]=> int(3088552834067437318) ["is_dir"]=> bool(false) ["realpath"]=> string(36) "/etc/php.d/opcache-default.blacklist" ["expires"]=> int(1424647280) } }

the cached directory are no longer there. Looks like it works only the 1st time and then the realpath cache disappeared somehow. Is my output normal?

Thank you very much.

Justin

@Whissi
Copy link
Owner

Whissi commented Feb 22, 2015

Hard to tell...

First, remember what the extension is doing: While patching https://bugs.php.net/bug.php?id=52312 the PHP team decided to set realpath_cache_size_limit = 0 (which disables the realpath cache) when safe_mode or open_basedir restriction is active.

realpath_turbo just uses the fact that the check happens before the extension loads. That's why you should unset open_basedir when using realpath_turbo, so that PHP won't disable the realpath cache. When the extension finally load, it will enable open_basedir like PHP would have done but without running through the check which would disable the realpath cache.

If you keep this in mind it is more likely that you are running a PHP application which clears the cache (i.e. with clearstatcache(true)).

If you want to use open_basedir restriction for /home/example.org/htdocs make sure to load realpath_turbo and set

php_admin_value[open_basedir] = ""
php_admin_value[realpath_cache_basedir] = "/home/example.org/htdocs:/usr/share/php"

in the used PHP fpm pool.

This will make sure turbo_realpath will prevent PHP from disabling the realpath cache and open_basedir restrictions are still working.

Now if no script is clearing your cache your realpath cache should grow and stay. Just tested on my servers.

@jjone
Copy link
Author

jjone commented Feb 23, 2015

HI, Thomas

I run magento on this dedicated php-fpm server. I don’t know if magento will clear the realpath cache.

I set the following in my php-fpm pool setting,

php_admin_value[open_basedir] = none
php_admin_value[realpath_cache_basedir] =none

Here are the 3 functions that I used to check the cache, I put it in a test.php file.
it works only the 1st time.

var_dump(realpath_cache_size());
var_dump(realpath_cache_get());
phpinfo();

Thank you very much

Justin

From: Thomas D.
Sent: Sunday, February 22, 2015 5:59 PM
To: Whissi/realpath_turbo
Cc: jjone
Subject: Re: [realpath_turbo] phpinfo() give me segmentation fault (#1)

Hard to tell...

First, remember what the extension is doing: While patching https://bugs.php.net/bug.php?id=52312 the PHP team decided to set realpath_cache_size_limit = 0 (which disables the realpath cache) when safe_mode or open_basedir restriction is active.

realpath_turbo just uses the fact that the check happens before the extension loads. That's why you should unset open_basedir when using realpath_turbo, so that PHP won't disable the realpath cache. When the extension finally load, it will enable open_basedir like PHP would have done but without running through the check which would disable the realpath cache.

If you keep this in mind it is more likely that you are running a PHP application which clears the cache (i.e. with clearstatcache(true)).

If you want to use open_basedir restriction for /home/example.org/htdocs make sure to load realpath_turbo and set

php_admin_value[open_basedir] = ""
php_admin_value[realpath_cache_basedir] = "/home/example.org/htdocs:/usr/share/php"in the used PHP fpm pool.

This will make sure turbo_realpath will prevent PHP from disabling the realpath cache and open_basedir restrictions are still working.

Now if no script is clearing your cache your realpath cache should grow and stay. Just tested on my servers.


Reply to this email directly or view it on GitHub.

@Whissi
Copy link
Owner

Whissi commented Feb 23, 2015

Justin, I don't understand why you are using realpath_turbo when you don't set open_basedir at all. If you don't want open_basedir restriction you don't need this extension.
If you want open_basedir restriction use this extension to set the restriction with realpath_cache_basedir instead of open_basedir.

Now you are basically not using this extension. In other words: Any problems you maybe experience have nothing to do with this extension.

PS: Also make sure that your application doesn't disable realpath_cache.

@jjone
Copy link
Author

jjone commented Feb 23, 2015 via email

@vpal
Copy link

vpal commented Apr 8, 2015

Hi Whissi,

I would suggest to remove the feature if it causes crashes.

Thanks

@Whissi Whissi closed this as completed in 2dd5531 Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants