I Am using a session on a website and I am unable to take the data on the other page. I have used the code on other host and its working fine on other host so I think that the host problem.
The code I used to save the session is:
session_start();
$_SESSION["std_id"] = 'rst';
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
And I am retrieving it on the other page with this code:
session_start();
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
As I said its working fine on other host as well as on localhost, so that is the server issue, but I need to keep the login info of the user as we use to maintain login record through session.
We have installed Joomla on that site and its working fine its maintaining all the login info and every thing.
Can anyone suggest me the solution other than changing the host :)
Thanks.
Edited:
I can't show the host name as due to some reason.
The domain I am using is a sub-domain for a University department and the main site is of University site, and I am using this code under a new folder at sub domain.
do you get any errors in your error log or in php error reporting (error_reporting)?
like "No session exists - writing to test_value"
you can also test your current session directory if its writeable:
$writeable = is_writable(ini_get("session.save_path"));
one solution is to change your session directory with this:
(create the /tmp directory by hand in your root)
ini_set("session.save_path","/tmp");
or to your .htaccess
php_value session.save_path /tmp
and give 0777 permission in that /tmp directory, which must be in your root.
As I see in your codes, everything looks fine. You do not need to change your host just contact to your host provider. I've had a similiar issue with a host before. If you contact them, they will edit your php.ini file to allow you to start sessions.
Note : Not every host providers allow users to use many features of PHP. You have it ask them to set it on. They turn these features off to save CPU usage.
Related
I have a web server running LAMP. I have the website tbg.robotpidgeon.com set up to run the PHP login system that I copied from here (https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php).
Very basic login system using MySQLi.
In my apache2 config file for this web address, I have set up the virtual host and pointed it to where the PHP files are located. However, when you go to the above address it generates an index of the PHP files.
When I try to set up the virtual host to land on the login or welcome page I get a too_many_redirects error. So I am assuming that I have created a loop when I set the virtual host document root to a specific PHP file?
What should I do so that when I go to the above address it goes to the login/register page?
The browser is stopping you from hammering the server with a bunch of
requests. This is most likely due to the header() sending you to a
page which in turn sends you to the same page (or page with the same
header()).
In your session.php you have to destroy the session because it might
be set still but without that the query can find a existing user?
To unset sessions do this:
unset(); for all the session variables
unset($_SESSION['login_user']); for a specific session
I've just moved my site from local (xamp on my windows) to AlterVista.
I developed the site with Joomla. In local all okay. When I upload my site it works but I can no longer access to the Joomla control panel with the default/administrator next URL site.
Though, more details could help in detecting the problem but please check these if you've not so far:
Path to the temp and logs folders in [Joomla! Root]/configuration.php.
If you've renamed htaccess.txt, check if .htaccess is all set on the server. Sometimes, your operating system doesn't transfer hidden files and .htaccess can be a hidden file, depending to your OS settings.
Call an inner admin page to test if the admin folder is responding. Something like: domain.com/administrator/index.php?option=com_content.
Via FTP or Host's file manager check if all files are transferred completely.
Clear all of your web browser's cache and retry.
In addition,
I transferred a Joomla! (new version) last week and faced to this. So, it also can be a Joomla! bug.
I have solved my problem. Also in the configurazione.php there was a linea, the " public $force_ssl = '0' " that was setted to 1. Also my /administrator/index.php was asking to my a certificate to log in... I had only to set this value to 0 to resolv my "TOO MANY REDIRECTS" problem...
Thanks for time! I Hope this post Will bè helpfull for someone.
im working with scriptcase php code generator and as i build up my project, i uploaded it into my account in siteground.com. Now, i try to open it from the browser using mydomain.com/project_folder and it needs the initial configuaration.. all well till now, the prboblem starts when i get to the 3rd step where i need to setup or edit my db connection.. here it shows me this:
"404 - Not Found
The page you are trying to access does not exist.
If this error persists, please contact the website webmaster.
If you are the webmaster of this site make sure that:
You have uploaded correctly your files to the public_html directory which is the web-root of your account;
You have not misspelled the URL. Bear in mind that letters are case sensitive and no blank spaces are recommended;
In case you have applied SEO - SEF URL rewrite rules, make sure you have renamed the htaccess.txt file to .htaccess. If there is already a non-empty .htaccess file, check it and make sure the necessary rules are uncommented."
.. and, when i click on the rename connection, it shows:
"Rename Connection
There are no connections saved on the production environment."
none of these reasons is the one causing the problem..than what should i do??
thanks in advance!!
Not sure about siteground but important to give all files in the _lib directory of your app 777 permissions while you are setting it up
Also SC heavily uses sessions -- make sure you clear all cookies in your browser when moving from one SC app to another
Local magento installation is redirecting me to our live test site rather than utilizing the local files. Index file is being read until Mage::run(), then the redirect occurs:
Mage::run($mageRunCode, $mageRunType);
Details:
I pulled down the Magento system files and database from our live test environment and set them up on my local machine's Linux environment. Everything seems to have gone smoothly, except when navigating to my root directory in a browser I am redirected to our live test site (rather than seeing my local files).
My question is... What code in the source configuration or database table would house the information for this redirect? I cleared the Magento cache using a script I found on Stack from someone with the same issue:
require_once 'app/Mage.php';
$app = Mage::app();
echo "<pre>";
if($app != null) {
echo "The app was initialized.\n";
$cache = $app->getCache();
if($cache != null) {
echo "The cache is not empty. Clean it.\n";
$cache->clean();
}
}
The asker says it was a cache issue, but the above script did not resolve my issue. I assume there is a configuration/cache file that houses an installation's "root" directory, and that it is still pointing to our live site. I grepped through several of the directories to no avail.
Any assistance with this (and any other issue you think I may stumble across in this process) would be greatly appreciated. Thanks!
You need to change the value in the core_config_data mysql table:
UPDATE core_config_data SET value='http://live-site.com/' WHERE
path='web/unsecure/base_url'
and do the same for web/secure/base_url. If you have several shops you should also filter on scope/scope_id.
I have been trying to debug this problem for hours but couldn't. I have these two files:
My first file:
session_start();
$_SESSION['user'] = '1';
My second file:
session_start();
print_r($_SESSION);
echo $_SESSION['user'];
But The second file echoes an empty array. This works fine on my localhost but didn't work on online server. I also have 'register_globals' turned off in php.ini
If you are using cPanel goto cPanel > php.ini QuickConfig >
Check for
session.save_handler = files
session.save_path = /tmp
If you have still facing the problem ask your cPanel guys they will help you
i was also facing the same issue with ipage hosting now it is solved with Radhakrishna Chowdary`s help i did following-
login to your ipage hosting account
go to Additional Tools -> CGI and Scripted Language Support
there choose PHP Scripting
there you will see "Edit your php.ini file for PHP 5.3" click on
edit.
change value of session.save_path `s value to "/tmp"
its done working now :)
iPage requires you to specify the session_save_path() within your script. Like so :
session_save_path("your home directory path"/cgi-bin/tmp);
session_start();
Take a look at this iPage Knowledgebase article for further reference.
Try changing the session variables like $_SESSION['user'] to $_SESSION['userr']
as changing the variable names worked for me for php 5.3 on ipage
Changing 'session.save_path' is not working I tried this a lot but nothing fixed, I contact there support to fix the issue for me, but they said session is disabled in ipage, which is something very bad for cPanel site.
But anyway I recommend another hosting service since iPage doesn't support session which is something main in php development for login and save data.
I recently receive this from IPage customer service:
this mean that the "session.save_path" will never change in 'php.ini', you have to do it in your code as mentioned from there customer service.
Remember to add this line before session start
session_save_path('/home/your/home/directory/path/cgi-bin/tmp');