authentication not working in php file [duplicate] - php

This question already has answers here:
PHP Fatal Error Failed opening required File
(7 answers)
Closed 9 years ago.
i have a login system, which redirect user to his workplace after login and i have set the logout button and to clear session i have done this:
This code check for session, which is created after login:
this code in included in workplace area after login.
UPDATE 2:
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/ModelBase/connect/auth.php');
?>
but after login ; i get this error when i upload it to host:
Re-UPDATE 2:
Error after updating require_once statement again:
Fatal error: require_once() [function.require]: Failed opening required '/data/19/1/86/59/1901711/user/2069354/htdocs/xxxxxx/connect/auth.php' (include_path='.:/usr/services/vux/lib/php') in /data/19/1/86/59/1901711/user/2069354/htdocs/xxxxx/xxxxx/xxx/index.php on line 2
Found the solution myself.. Thanks everyone anyways..
just was missing 1 part of path folder and that fixed up all..
NOTE: When i use this same process over localhost it never shows any error. what should i do ?

you have error in include file path try
require_once($_SERVER['DOCUMENT_ROOT'].'/ModelBase/connect/auth.php');

Change this line:
require_once('$_SERVER['DOCUMENT_ROOT']./ModelBase/connect/auth.php');
To:
require_once($_SERVER['DOCUMENT_ROOT'].'/ModelBase/connect/auth.php');
Done:)

Related

How to fix intermittent PHP Fatal error: Unknown: Cannot find save handler '/var/lib/php/session' [duplicate]

This question already has an answer here:
Warning : session_start(): Cannot find save handler 's' - session startup failed
(1 answer)
Closed 3 years ago.
Very intermittently and rarely my Centos7 httpd 2.4.41 and php 5.6.40 server will half load a page. The PHP loads, but the CSS and JS includes get the error 'Connection Reset' in chrome and dump this error into the php error log.
PHP Fatal error: Unknown: Cannot find save handler '/var/lib/php/session'
I have checked permissions on the session files, and the server has plenty of space, the fact that it works most of the time makes my scratch my head.
I've tried switching to memcached but same issue.
Can anyone share any light on whats causing this error?
Or perhaps a way to stacktrace the httpd PID after the fatal error?
Thanks in advance guys.
This issue might be related to your session save path. If you are not precious on where to save the sessions.
edit your php.ini and change the following
we are using the /tmp directory here.
session.save_path = /tmp
more information can be found here
http://www.php.net/manual/en/session.configuration.php#ini.session.save-path

Fatal error on captcha implementation [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 8 years ago.
After following the PHP implementation from the captcha guide, I get the following messages on the page where the captcha should appear:
Warning: require_once(/var/www/resources/recaptchalib.php): failed to open stream: Permission denied in /var/www/submit.php on line 49
Fatal error: require_once(): Failed opening required '/var/www/resources/recaptchalib.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/submit.php on line 49
My line 49 is:
require_once($_SERVER['DOCUMENT_ROOT'].'/resources/recaptchalib.php');
What am I doing wrong?
My first guess would be: nothing, your code is probably okay.
The error message tells everything, probably the file access rights (or ACL-s) are misconfigured. The user, who runs you webserver, does not have the neccessary rights to access that PHP file.

Admin panel not accessible in wordpress [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 9 years ago.
I have deployed the wordpress blog on my site sqlhelps.com. The site is hosted on asp.netdiscount server. I cannot access the sqlhelps.com/wp-admin. The error is as follows :
Warning: require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php): failed to open stream: No such file or directory in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60 Fatal error: require_once(): Failed opening required 'E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php' (include_path='.;C:\php\pear') in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60
Can anyone please help me out with this?
Either user.php is not available on your server or you are giving the wrong path as you can see error is :
No such file or directory in E:\web\.......
In E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60, try changing
require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php)
to
require_once(E:\web\sqlhelpscom\htdocs\wp-admin\includes\user.php)
so all the slashes are going the same way.
Jason

Codeigniter, getting PHP error after moving server folder [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
I tried to move my codeigniter server folder to Amazon EC2 server.
I zipped whole file with "tar cvfpz" command and move the file to new server.
I unzipped by using "tar xvfpz" command.
My new server setting is fine, but I get this error.
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/playmobs/_application/controllers/home.php:188)
Filename: core/Common.php
Line Number: 442
404 Page Not Found
The page you requested was not found.
I checked the database config file and all other config files.
All of them have correct commands for new server.
Can you see why I see this error?
Thank you.
You get this error, because probably you send output before sending header. This error can have a lot of reasons.
Here is really well documented solution: How to fix "Headers already sent" error in PHP
I solved the problem.
The reason was that I moved to the new server and didn't turn on PHP short cut command.
my code was like this.
<? ----- ?>
New server php didn't recognized this one.

why do i get 1 instead of the file required? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
including php file from another server with php
i want to have my own error system instead of having the php errors so for example i require a file from another server and that server is not available right now
<?php
require 'http://example.com/file.php' or die ("that host is not available right now");
?>
but instead i get
Warning: require(1) [function.require]: failed to open stream: No such
file or directory in C:\xampp\htdocs\index.php on line 5
Fatal error: require() [function.require]: Failed opening required '1'
(include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\index.php on line 5
It's because require 'foo' or bar() is interpreted as require ('foo' or bar()). 'foo' or bar() equals true, i.e. 1. If you want to write it like this, use different parentheses:
(require 'http://example.com/file.php') or die ("that host is not available right now");
But, you don't need die at all here, since require will already halt program execution if the required file can't be loaded. Just require 'http://example.com/file.php'; will do fine. Whether you should actually load foreign PHP files over the network is another story (hint: probably not).
The problem is the precedence of operators. The PHP are including the result of the "or" comparison (true). Try to remove this.
include('http://...') or die('error...');
It will work.

Categories