Помогите настроить по человечески PHP

promog

Новичок
Помогите настроить по человечески PHP

Ребята помогите по человечески настроить PHP.INI !!!
Возникают проблемы с сессиями!!!

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
; As of PHP 4.0.1, you can define the path as:
; session.save_path = "N;/path"
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
session.save_path = /tmp

; Whether to use cookies.
session.use_cookies = 1

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data. php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 100

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 43200

; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm

; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit register_globals
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning seperately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.

session.bug_compat_42 = 1
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
; to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
; in publically accessible computer.
; - User may access your site with the same session ID
; always using URL stored in browser's history or bookmarks.
session.use_trans_sid = 1

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden <input> field with the info which is otherwise appended
; to URLs. If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a "=", even if no value follows.
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

ПРоблемка возникает такая!
Сессии работают но не хотят удаляться функцией
session_unregister();


И session.save_handler = files здесь вместо files может быть что-то другое! Да и еще не работают PHP_*_VARS[] !
Заранее спасибо!
 

_RVK_

Новичок
> работают PHP_*_VARS[]

И слава богу. Используй $_GET, $_POST...

>Сессии работают но не хотят удаляться функцией
>session_unregister();

Сессии этой функцией и не удаляются. Забудь о ней навсегда. Для удаления переменной сесии используй unset($_SESSION['var'])

Как резюме, выкинь ту статью(книгу) по которой ты пытаешься изучать PHP. Она сильно устарела
 

promog

Новичок
Автор оригинала: _RVK_
> работают PHP_*_VARS[]

И слава богу. Используй $_GET, $_POST...

>Сессии работают но не хотят удаляться функцией
>session_unregister();

Сессии этой функцией и не удаляются. Забудь о ней навсегда. Для удаления переменной сесии используй unset($_SESSION['var'])

Как резюме, выкинь ту статью(книгу) по которой ты пытаешься изучать PHP. Она сильно устарела
Ну понятно! Но я хочу чтоб у меня стандартные скрипты исполнялись!
Хочу чтоб все по стандарту было как у хостеров!!!!
Может кто-нибудь поможет настроить! Буду очень благодарен!
Я просто уже какой месяц бюсь никак настроить не могу!!!
Заранее спасибо!!!
 

_RVK_

Новичок
о каких стандартах речь? о каких скриптах? каких хостерах?
 

promog

Новичок
Автор оригинала: _RVK_
о каких стандартах речь? о каких скриптах? каких хостерах?
Вот как настраивают хостеры свои php.ini?!
Ну допустим возьмем msterhost !
Просто CMS система одна работать не хочет!
Вот кусок авторизации скрипта котрый некоректно работает!
--------
<?
@session_start();

function get_ip(){
$ip = getenv('REMOTE_HOST');
if(!$ip)$ip = getenv('REMOTE_ADDR');
if(!$ip)$ip = $REMOTE_ADDR;
if(!$ip)$ip = $REMOTE_HOST;
return $ip;
}

if (session_is_registered("loginrights") && $login) {
$loginrights=db_res(db_q("select * from admin_users where log='$login'"),0,"rights");
session_register("loginrights");
}

if ($act == 'exit') {
require_once 'library/shead.php';
if (session_is_registered("login")) {
$res1=session_unregister("login");
$res2=session_unregister("logintype");
$res3=session_unregister("loginrights");
if (session_is_registered("helper")) session_unregister("helper");
$res4=session_destroy();
if ($res1 && $res2 && $res3 && $res4) echo "Вы закончили работу с ".$wcm_version.".<br>Спасибо за Ваш выбор.";
else echo "ERROR";
}
require_once 'library/sfoot.php';
}



if ($HTTP_POST_VARS['log'] && $HTTP_POST_VARS['pas']) {
$check=db_q("select * from admin_users where log='".$HTTP_POST_VARS['log']."' and pas='".$HTTP_POST_VARS['pas']."' and (ip='".get_ip()."' or ip='') and vis='1'");
if (db_nr($check)) {
session_start();
$login=$HTTP_POST_VARS['log'];
session_register("login");
$loginrights=db_res($check, 0, 'rights');
session_register("loginrights");
if (db_res($check, 0, 'type')!='Читатели') session_register("logintype");
}
else {
require_once 'library/shead.php';
echo "Неверная комбинация.";
require_once 'library/sfoot.php';
}
}

if ((!$HTTP_POST_VARS['log'] || !$$HTTP_POST_VARS['pas']) && !session_is_registered("login")) {
require_once 'library/shead.php';
?>
<form method=post action="<?=$PHP_SELF;?>">
<input type=text name=log maxlength=100 class="control">
<input type=password name=pas maxlength=100 class="control">
<input type=submit value=" войти " class="searchbt">
</form>
<?
require_once 'library/sfoot.php';
}
?>
-------
 

Фанат

oncle terrible
Команда форума
причин может быть миллион

-~{}~ 12.12.05 12:53:

Помогите настроить по человечески PHP
кстати, по умолчанию, то есть без всяких изменений в настройках, пхп как раз и настроен ПО-ЧЕЛОВЕЧЕСКИ.
 

_RVK_

Новичок
promog
тебе что так дорог этот код? зачем ты так упорно пытаешься заставить работать это старье?
 

promog

Новичок
Просто CMS системана всех хостерах работает а у меня нет! Вот хочу ее добить и добить в конце коцов этот php ! Может это из-за того что у меня Apache 2.0.53 стоит?!
У меня просто когда я авторизауию прохожу в /tmp создаеться файл сессии который весит 0 байт ! Тоесть пустой ! И у меня предположения что он вообще переменные не видит ! Хотя в php.ini прописанно так
----
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3

; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.output = "&amp;"

; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
;arg_separator.input = ";&"

; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
; referred to as EGPCS or GPC). Registration is done from left to right, newer
; values override older values.

variables_order = "EGPCS"

; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.

; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
; ### MDK: This is set to On in Mandrake because a lot of existing scripts
; ### MDK: needs it to be on, and we don't want to break configuration.
; ### MDK: Turning it on is a Bad Thing (tm), but for the sake of
; ### MDK: compatibility and less technical support, we'll close our eyes ;-)
register_globals = On

; This directive tells PHP whether to declare the argv&argc variables (that
; would contain the GET information). If you don't use these variables, you
; should turn it off for increased performance.
register_argc_argv = On

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

; This directive is deprecated. Use variables_order instead.
gpc_order = "GPC"

; Magic quotes
;

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"

; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_data = Off

----
 
Сверху