latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Do not access this file directly.

Home Forums Community Forum Do not access this file directly.

This topic contains 6 replies, has 3 voices. Last updated by  Bruce 3 years, 7 months ago.

Topic Author Topic
Posted: Wednesday May 29th, 2013 at 1:21 pm #50848

Hello,

The s2member plugin will not activate on the production server. I get this error message:

Fatal Error.

Do not access this file directly.

Any suggestions on how to debug this?

I have confirmed that the exact source and database dump will work on an ubuntu development box with the PHP and mysql there.

It’s either the PHP configuration (file permissions have been opened up to debug this, and suhosin has been deactivated(not loaded at all in fact)), php configuration could be missing an extension? What extensions are required?

Or it’s a networking problem, the firewall is restricting something maybe? Outgoing http is fine, it can load google.com and use http with bitbucket for example. Is there any other communication that might be blocked?

The s2-server-scanner.php was run and it passes all its tests except for wordpress debugging mode.

Thanks!
Rich

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Thursday May 30th, 2013 at 2:40 am #50915

The s2member plugin will not activate on the production server. I get this error message:

I’m not familiar with that… What file is it refering to? Where do you get that error? When you try to load what page? Right after clicking the “activate” link for s2Member Framework?

If you want, you can send your site’s info and leave here the steps I should take to reproduce it. s2Member® » Private Contact Form

Posted: Friday May 31st, 2013 at 12:34 am #50978

Yes, right after clicking on Activate.

The string “do not access this file directly” is in all of the s2member source code files. Is there some PHP or Apache config that would lead to this? The exact same source and database works on a development host.

I don’t know the steps to make it happen, if I knew that I’d have fixed it ;-)

Posted: Friday May 31st, 2013 at 8:27 am #51037
Bruce
Username: Bruce
Staff Member

The string “do not access this file directly” is in all of the s2member source code files. Is there some PHP or Apache config that would lead to this? The exact same source and database works on a development host.

s2Member only throws this error when a PHP file of s2Member’s is accessed directly. For example, if you access this URL:

http://www.s2member.com/wp-content/plugins/s2member/s2member.php

You’ll see that you get this error. s2Member checks your PHP SERVER variables and checks to see what page the User is attempting to load to find out if the User is trying to load the file that’s loading. This is a common practice and you’ll see similar functionality in many popular WordPress plugins.

If you’re getting this error then the issue lies either within the URL you’re accessing or your PHP Server variables. Try var_dump’ing your $_SERVER array.

See: http://php.net/manual/en/function.var-dump.php

Posted: Sunday Jun 2nd, 2013 at 11:49 am #51177

ah ha! ..
when I access the file s2member.php on the dev system that is working correctly I get:

Do not access this file directly.

when I access on the broken production I get:

Fatal error: Call to undefined function get_bloginfo() in /opt/ibiology/wp-content/plugins/s2member/s2member.php on line 113

This means it fails for some other reason to include the necessary files to run, and the “do not access” is just a symptom down the road for that.

So I’ll look at include paths? And dump out some super globals…

Thanks!

Posted: Sunday Jun 2nd, 2013 at 2:14 pm #51186

I believe it’s fixed. The problem had to do with bad SCRIPT_FILENAME, which was a side-effect of the PHP-FPM config, where you have to tweak the paths with symbolic links in order to only pass PHP through the PHP handler and nothing else (e.g. static files).

My edited prepend.php file:

$_SERVER[ 'SCRIPT_NAME' ] = str_replace( '/mywebsite-virtual/', '/', $_SERVER[ 'SCRIPT_NAME' ] );

// this is just totally wrong,  file does not exist
// how is a non existent path going to be useful to the server?
// in any case it's causing problems with Wordpress
//$_SERVER[ 'SCRIPT_FILENAME' ] = str_replace( '/mywebsite-virtual/', '/', $_SERVER[ 'SCRIPT_FILENAME' ] );

$_SERVER[ 'PHP_SELF' ] = str_replace( '/mywebsite-virtual/', '/', $_SERVER[ 'PHP_SELF' ] );
Posted: Tuesday Jun 4th, 2013 at 4:30 am #51277
Bruce
Username: Bruce
Staff Member

I believe it’s fixed. The problem had to do with bad SCRIPT_FILENAME, which was a side-effect of the PHP-FPM config, where you have to tweak the paths with symbolic links in order to only pass PHP through the PHP handler and nothing else (e.g. static files).

Yes that sounds like the issue. s2Member is checking this value and running it against the realpath() of itself, so this would cause errors.

http://php.net/manual/en/function.realpath.php

Glad to hear you fixed your error. :-)

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.