News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Possible to 'find', the real, path on server for SSI.php?

Started by richardwbb, June 21, 2017, 03:36:43 PM

Previous topic - Next topic

richardwbb

By purposefully opening 'SSI.php', I've seen; 'Het is niet mogelijk om SSI.php direct per URL te benaderen; gebruik het pad ('SSI.php') of voeg ?ssi_function=something toe.'

That is saying loosely translated; "It isn't possbile to open SSI.php by direct URL, etc."



Now my ISP has changed the server, I've tried this my best. Because I have seen many times contact your ISP, I say I already did.

But, would it be possible with something like "DIR". [php]?

The Cron-php and the php to write my own stuff contains; '__DIR__ .'/SSI.php, $_SERVER['REMOTE_ADDR'].'

My imagination tells me to say to the php engine, 'hey php' [<?php], __DIR__ [bool- am I, or; am I not, 'in'/ 'inside', ../SSI.php. Or even simpler written by me with DOS; bat; cd .. [get directory path, that would be pwd.exe, which I have downloaded]], sorry if this is confusing or programmer. I sense something inside smf source, that something like that is going on with or without, [I am not sure there], mysql, to get the real path.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Kindred

SSI needs to be in the same directory as the root of your forum...  e.g. the same directory as Settings.php

Which means that the absolute path to SSI should be the exact same as the absolute path of your entire forum...

and no, you can not access SSI.php directly via a browser... but you can access ssi_examples.php -- although that does not give the path either... because the path is the same directory and does not need to be specified with the examples file.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

richardwbb

Dear Kindred, I'm not really following what you are saying. But please do not yet attempt to clarify [yet]. I had everything in working order. Then, the isp switched server. Now it is saying '500'.

So, I notified them, and they said it is 'SSI.php' that isn't proper.

And since I feel that this then must be a bug [which I don't believe], I believed I was smart with;

<?php // Haal SSI.php op //

$filename 'forum/SSI.php';

if (
file_exists($filename)) {
echo 'exists';
    
//require('/var/www/nissan100nxclub.nl/public_html/forum/SSI.php');
} else {
    
//require("forum/SSI.php");
echo 'exists not';
}
echo 
'tst';
    require(
'forum/SSI.php');
echo 
'tst-2';
?>


This is saying; 'existstst', where 'tst-2' is never getting echo'd.

Now the strange part is, they change the server, and the 'Direct Admin' [on the old server], -was- able to give directory paths [this by it's 'back end/ web management] The new server didn't accept; 'require('/domains/nissan100nxclub.nl/public_html/forum/SSI.php');, which is the working path from the 'old' server. [there was also a load of htaccess problems with my -not changed- htaccess and it took them five working days. And now this. I feel like crying. [I also worked hours with them because they had something backward and that was like a single lamp [my forum/ website with them], and two switches. Really annoying [but maybe hard to follow].

However, now the path has to be 'forum.SSI.php', and that one does exist according to the php engine [so I figure that Apache is telling this to the php engine].

Now, the big question; how would this be possible, I dived in to this, and are at the point to look for a working 'SSI.php-response', of the -not changed a single bit of code-, instead of trying to fix this. Also please let me think on what you wrote. This isn't just hard for me. Your words will have to refine with me. Thanks.

Oh, I did get the part with the 'ssi-examples.php'. I remember that. I will follow that. And oh dear, I forgot another thing; the '/var/www/.../' path is for my localhost server. The not working path with the isp is; '/domains/nissan100nxclub.nl/public_html/forum/SSI.php'.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Kindred

Quote from: Kindred on June 21, 2017, 04:10:33 PM
... the absolute path to SSI should be the exact same as the absolute path of your entire forum...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

richardwbb

Thank you for your answers.

I will try this.

And since the forum is in a "sub-domain?" [example; <sub>.domain.tld], Apache seems not to be 'able' to get in there. And, this worked without change. But the ISP has maybe closed too much. In the ftp path it is saying something like "/domains/domain.tld/pub-html/<sub>.

And for php, 'getcwd', and the SSI.php it self, it is saying '500'. But the ISP said, it was 'the script', and, I feel there wasn't much for them to say. Their support has it's limits. But someone by 'root', for many years, has been closing things, and not everything, I understood as a 'useful', security messure. They do not use mod-security, and they are smart, patient. But, to not write a long story about this; what is written here and what was said between me and the people of the ISP [support], won't compute. It just must be 'root', and usually the support hasn't 'root' rights, nor, php.ini nor apache2.conf. Again, I'm not doing a thing, just thinking about this, and have to run a local copy [which borked a little], that; isn't as time consuming as this. But I would like to understand their htaccess-php-apache, changes. They have heavily secured with htaccess, and php.ini. I'm for seven years with them now,
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

richardwbb

I've been working/ thinking about this and I regret, to no avail. Of course, https://virtual.domain.tld/ssi_examples.php is working.

The Apache-php/ and the SSI.php claims to use; path ('/home/user/domains/domain.tld/public_html/forum/SSI.php') and with this; "or add ?ssi_function=something".

My understanding is that the "call"; <?php ssi_boardNews(); ?>, is the one I am after [the url that SSI.php itself claims [underlined], just won't work I am sure now. However, that might mean it won't work in another way either, I believe. It is a regular topic, for a not logged in visitor.

By writing this post, I hope to get confirmation; would that be ?ssi_function=ssi_boardNews and/ or would that be slightly different. The reason I am asking is that for a Apache 500, that is kind of hopeless as a tracking guide?

The only other option I have gotten, is that the ISP explained to me that when I can proove they are wrong, that then they will fix [something that worked before and does work with my localhost setup. And that answer, that is the way I know my ISP. I rather spend more time working this one out, then a "php to text file by cron" and "echo with php, workaround".
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Chen Zhen

If the PHP file is located in the same path as your forum's main files then use:

[-A-]

require_once(dirname(__FILE__) . '/SSI.php');
ssi_boardNews();


However if I understand your posts it seems as though the php file you are using is located in a sub-directory of the path that your forum is located in.
If it is only one sub-directory then you can use the DOCUMENT_ROOT global:
[-B-]

require_once($_SERVER['DOCUMENT_ROOT'] . '/SSI.php');
ssi_boardNews();


or if you prefer you can use multiple dirname to backtrack directories
ie. back one sub-directory  ( same outcome as example B except it is using ssi_recentTopics() )
[-C-]

require_once(dirname(dirname(__FILE__)) . '/SSI.php');
ssi_recentTopics();


My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Kindred

quite honestly, the absolute path to SSI is always the best option rather than trying to figure out relative paths
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

richardwbb

#9
Chen Zhen, I thank you for clarifying this for me [my person].

Kindred, while I now have gained some more understanding of "php-internals", I do agree. While I can repost my story, I now believe I have proof that it won't work, because this php file has been uploaded by me to domain.tld/<directory named forum>. Somewhere in between the real path contains '/domains/', 'public_html', and on top of that '/forum' that is getting redirected by Apache to forum.domain.tld. This root person I've once seen his name [e-mail] of and the director/ owner of this ISP is administrative contact now. Root can only be reached now since I do remember the personal e-mail of the director/ owner. And for a annual fee of 6 Euro, my story better be more solid than a well written complaint [which is kind of not possible, prooving things with a http 500 that just popped up].

And that is a virtual domain, thus no www and then Apache is redirecting domain.tld/forum to forum.domain.tld, and humans won't type http/ https or even www. And for seo purposes and simplicity, that just looks better on a search engine result.

My point is that this 'static php' file, has been copied by me from domain.tld > domain.tld/forum and that is working, so it seems to me they have been switching things off, for a reason I can not comprehend. Apache seems to bork at the php engine while I believe it has been the php.ini and this is a shared hosting solution. Apache seems not to be master any longer over php, and php does give error output when you know how. Apache logging in combination with .htaccess has made things harder then they need to be is what I believe.

I am now thinking about working around the problem. As a temporary fix I have written this "static php" file out to .html, and uploaded that. But other people then I do, update topics with a calendar, and this person I asked several times, please send me a personal message and he failed that with a hundred percent score.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Kindred

richard...   you are confused between PATH and URL...  they are two completely different things (although often related)

in order to use SSI, you need the ***PATH***. The use of a subdomain is irrelevant.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

richardwbb

I'm having a hard time understanding this, but I can say that this topic, is a good note for me. I often read what has been posted, give it some time, then re-read what was been posted.

But what has happened, remains unclear to me. The SSI.php can be called in two ways "directly';
domain.tld/forum/SSI.php
forum.domain.tld/SSI.php

I noted that this makes no difference for the output of SSI.php; "use the path ('/home/username/domains/domain.tld/public_html/forum/SSI.php') or add?ssi_function=something"

The .htaccess [inside 'domain.tld/forum', makes sure that everything that went to 'domain.tld/forum', is being redirected to; 'forum.domain.tld', this is done with;
Redirect 301 /forum https://forum.domain.tld/ and this is necessary because the shared hosting solution of the ISP [Direct Admin], does need to know what directory is a virtual one [this has to be administered with a web based gui], but doesn't show or add the contents of this code quote meant for .htaccess

And in the end, I really don't remember how I was able to get things working again. The SSI.php now can be called from 'domain.tld', while SSI.php resides in 'domain.tld/forum'. But I have no explanation for why it is working now. Of course that made me happy, now the people that administrate their topic 'meetings', can adjust to there liking, and everything is automatically being updated. Solved.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Gluz

I been following this thread and what I don't understand is, what are you actually trying to do?

Calling SSI.php directly in the browser goes nowhere, you can't do anything, thus no matter how you put that URL, if there are redirects or whatever, it doesn't matter because you don't call it by URL.

If your are going to use the SSI functions, then you have to call the SSI.php file from your PHP script, that should be the same server, and the SSI.php file should not be moved anywhere, it must remain in the same directory as the forum files, then from your script you call it using the PATH, that is the directory tree where the file resides, and the easiest way is to use the absolute path, the one that's in the Settings.php of your forum as the $boarddir = '/here/the/absolute/path/to/the/forum'; is the one you have to use in your script to call the SSI.php file.

Or if you know exactly how to traverse from where your script is to where the SSI.php is as if you were typing CD in a terminal/console, then you could use a relative PATH, but if you are not getting the basic of calling a PHP script from another, then just use the absolute PATH as said above.


PS: I see you saying ISP but you are actually referring to your Hosting, ISP (Internet Service Provider) is the one that gives you the service to browse the interwebs, and the Hosting company is the one that have your website in their servers, unless is the same the one that provides you internet service and also host your website, that therm you been using is wrong, and as a non-native english speaking that just make it a little more difficult to understand what you are talking about.

richardwbb

Quote from: Gluz on July 24, 2017, 06:50:35 PM
I been following this thread and what I don't understand is, what are you actually trying to do?
I am not able to explain this because now after many attempts it is working again and I even't can't be sure the hoster has enabled things back. Or maybe it is a difference php had with single quotes and double quotes. I understand my words where confusing, but that is also because I am still having a hard time understanding this.

QuoteIf your are going to use the SSI functions, then you have to call the SSI.php file from your PHP script, that should be the same server, and the SSI.php file should not be moved anywhere, it must remain in the same directory as the forum files, then from your script you call it using the PATH, that is the directory tree where the file resides, and the easiest way is to use the absolute path, the one that's in the Settings.php of your forum as the $boarddir = '/here/the/absolute/path/to/the/forum'; is the one you have to use in your script to call the SSI.php file.
I have had a look at $boarddir in Settings.php and noticed that there are single quotes used. Besides "calling inside php", I also see not to get what difference those quotes can have, while I have been reading up on the subject.
Quote
PS: I see you saying ISP but you are actually referring to your Hosting, ISP (Internet Service Provider) is the one that gives you the service to browse the interwebs, and the Hosting company is the one that have your website in their servers, unless is the same the one that provides you internet service and also host your website, that therm you been using is wrong, and as a non-native english speaking that just make it a little more difficult to understand what you are talking about.
Thank you for pointing this out, I've indeed used "ISP", while I meant hoster.
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Advertisement: