TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   $_SERVER['SCRIPT_FILENAME'] empty? (http://www.talkphp.com/general/5636-_server-script_filename-empty.html)

narven 11-21-2010 03:37 PM

$_SERVER['SCRIPT_FILENAME'] empty?
 
Hi,

Can someone tell me if it's possivel that this:

PHP Code:

echo $_SERVER['SCRIPT_FILENAME'

doesn't do nothing? it's empty :(

any reason why?

thanks

tony 11-21-2010 05:25 PM

does this happen in windows with apache or IIS? I've read about this error happening in Windows.

narven 11-21-2010 06:21 PM

On my localhost (Windows with Apache) it works ok, but in the server running CentOS and Apache... doesn't work.

Could it be the PHP version? The server is runing PHP 5.1.6 and Apache 2.2.3

But the weird thing is that, if i run the phpinfo() and i look the at PHP variables, it gives me the SCRIPT_FILENAME :(

narven 11-21-2010 06:39 PM

nop sry.. it doesnt give in phpinfo()... i was looking at SCRIPT_NAME

tony 11-21-2010 07:00 PM

it shouldn't be the version, that functionality has been there since I can remember.
But the $_SERVER variables do depend on the server, so it might be a server difference of setup.
maybe __FILE__ would work for you.

narven 11-21-2010 07:16 PM

nop, i've testes that too with __FILE__, not working

Village Idiot 11-21-2010 08:17 PM

I know this sounds odd but if you are on a shared server they might cause that. Shared host sometimes restrict weird things. I cant think of a reason why none of those variables would be working.

narven 11-22-2010 03:59 PM

i'm not in a shared server.

i'm talking to the server admin's to try to fix that :) thanks

SaintIsaiah 11-22-2010 06:28 PM

1 Attachment(s)
Attached is the stock PHP 5.1.6 php.ini file. Backup your old one and replace it with the stock one, being sure to fill in any server specific information in the ini you need to get PHP running (extension dir, etc.)

I've had this issue before and it turned out to be a corrupted module dll (curl) that was causing my $_SERVER variables (PHP_SELF, SCRIPT_FILENAME, REMOTE_ADDR) to not function properly. It was only when I started with a stock php.ini file and enabled 1 module at a time that I found the issue.

Also, when you quoted your php code in your first post, did you properly terminate the line with a semicolon (";") in your code?

Hope this helps.

narven 11-25-2010 04:15 PM

thanks for that, but i cannot test that, because the problem is in the production server, i dont have control in those things.

but im talking to the administration servers to see what is possible to do

thanks.

narven 11-25-2010 04:16 PM

Quote:

Also, when you quoted your php code in your first post, did you properly terminate the line with a semicolon (";") in your code?
yes there is a semi colon


All times are GMT. The time now is 06:37 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0