CI Can't find session variable when project is accessed from server - php

EDIT: Zen's comment below (which is already the accepted answer) did the trick. I've overwritten the php.ini on the server with the one on my workstation. I no longer have this problem.
On the server: I've tried to print $this->session->userdata('uid') in the controller right after I've set this session, and everything's good during that point but when I var_dump this uid in my login page it returns false. It doesn't exist. I've also already tried erasing cookies and everything in my browser several times. Also tried rebooting.
On my localhost: Everything is working fine.
Has anybody experienced this?
Background: After the system gets the login information entered by the user then validated if the user exists in the database, that's when this session variable is set in the model.
Has anybody experienced this?
My work station is running XAMPP 1.7.7 on windows 7 and the server is using XAMPP for linux on centOS, my browser is chrome. Anything else I should specify please let me know.

Try using exactly the same php.ini file from your local server on the remote CentOS machine - this will eliminate the possibility of an error in the php configuration (and turns out, that happened...)
This should always be high on your "what is causing this unexplained problem with PHP?" list.

Related

Problem in nginx server not running php files suddenly

I have a dynamic website developed by native PHP on a server using NGINX which was functioning normally, but suddenly it broke down such that the PHP files no longer run and just download automatically to the client with the code whole source when he tries to excute that files. I don't know why it happened, and is it because of a hacking or an internal server problem. When I contact the web host, he says that a php file that is causing this problem, knowing that I haven't changed anything at last time.
Please clarify the cause of this problem if you have an idea !! Thank you in advance.
There is no idea yet ? I add that the last time, the host re-initialized the configuration of the VPS, and the website is now running well. It is clear that the problem was in the configuration! But I ask the same question, why did this failure happen? I want to know the reason: if the problem comes from PHP files or from the server itself !!

How to change 'No Privileges' for phpMyAdmin online?

I have a website I uploaded online. It works perfectly fine on XAMPP (localhost), but when online, it seems that functions like INSERTING new users to the DB (to register) do not work online, as well as many other INSERT functions. I gave all privileges on DirectAdmin, but on phpMyAdmin I still get "No Privileges".
Does anybody have a fix? and also, is it the phpMyAdmin blocking me from registering new users, or is the problem something else?
There are a few problems here, the most pressing is the lack of information.
phpMyAdmin runs on a web server, but it looks like you are using XAMPP, which is a pre-rolled solution for users that might not necessarily know how to configure phpMyAdmin in Linux/Mac/Windows, setup their own solution, or want something easy to deploy. There should be a log file you can grab.
I've never used XAMPP, but I have used phpMyAdmin for decades. Setting up using the default settings XAMPP is installed to "C:\XAMPP".
If I browse to that file I see a directory called "apache" and inside that "logs". This file, "error", should contain the error that will help us determine why your server is having issues with permissions.
**
Please send the text from the error file in
"\apache\logs".
**
This might be a bug with XAMPP, phpMyAdmin, your configuration, or something else. Paste the errors from the log file and I will be happy to look at them. I can't solve your problem with the information you have provided, but hopefully this will help point you in the right direction.

Error 0 couldn't connect to host in wamp windows 7

I have a joomla GIT repository of my project. We are using wamp and windows 7 as a development environment. This repository works fine on one machine. But when we tried to clone same repository on other two machines, we are facing a strange error.
Error is: Error 0 couldn't connect to host
As shown in screenshot.
All other repositories on those two machines work fine.
There is no error logged in under any of error logs file (apache, php and mysql).
I enabled joomla's error reporting. Searched on Google but, no luck.
Please help.
Thanks.
When you clone your Joomla to another machine, there are several things you need to double check:
Not only the files from the GIT, make sure the database is the same on the other two machines as well (export from the first one, import to 2 other one using phpMyAdmin).
Make sure the configuration.php file on two other machines re-corrected, includes: path to logs, tmp folders; database information (host, username, password, database name).
It should works.
Well, I debugged little bit more and finally found the solution. It was a small issue with missing web service link in one table. We are using com_api for web services. On first machine web service link value in table was local value respective to that machine.
On remaining two machines, we updated this to local value of those respective machines.
And it worked :)
This is not a standard Joomla error - it's either that this error is thrown by an extension or it is a server error.
Try adding a die(); at the beginning of your index.php file and see if it actually dies, if it doesn't, then this is definitely a server error.
If it does die, the use the function: get_included_files() and then make a quick search on all the files included on that page for the sentence "Couldn't connect". You will find the culprit easily this way.
Check your .htaccess file, maybe they have some rule which can not be met. (Rename this file if it exists and see what happening)
But I think that the problem is in the network settings. Errors often come from dns issues or, curl connection restrictions.
Check your DNS records
Check your Curl settings and try to create any Curl request.
Check your .htaccess
I don't think this error related to Joomla , I think it is connection from PHP to Linux, try to change the port of the Linux.
and restart the Apache and try again.

shell_exec is not working on server

i am using shell_exec to get whois details of a domain. Everything is working fine on localhost but when i am uploading the script on server, it is creating problems. On server, the shell_exec is working partially.
echo "shell_exec('whoami')";
gives me an output.
mac
but when i am using
echo "shell_exec('whois example.com')";
I am getting a blank page
Should i consider using a hosting account with root privilege? If yes then how to deal with security issues?
P.S- i dont know if something like this even exists but i've tested it on localhost and it is running fine on MAMP.
Thanks in advance.
If you do decide to host this script with root privileges, then you should (and I'm sorry) be locked up in a padded cell. That's just mad! You don't need root privileges to run a simple whois command. That's insane!
Hosting as root is about as safe as a nursery, ran by catholic priests, serial killers and crack addicts, who haven't had a fix in three days. Things are going to happen... You can only speculate as to when and how bad it's going to end.
Check using whoami what user is running the script, then check what it's PATH looks like, compare that to where whois actually is, if at all present. If it's not installed, ask your admin to set it up, and give you the rights to use it. If it's installed, try shel_exec('/path/to/bin/whois example.com');
Read up on user rights, and environment variables, (and how to load/manipulate them from a PHP script)

suddenly "my http Apache server stopped working" using xampp

every thing was fine suddenly my server stopped working there is nothing in error logs phpmyadmin is working fine the problem occurs when i am my project first home.php page loaded but when i am sign in entering email id and password server stopped working .
(i have not changed any thing in php.ini)
(earlier it was working fine)
pl
thanks
So, if I understand correctly, the server stops working after you log in? But phpmyadmin is still working? Something's not right there.
If phpmyadmin is still running after your problem, then the problem is most likely related to your apache config file.
If you cannot access phpmyadmin at all until restart of apache, then you effectively your apache server. However, since nothing is showing up in the error logs, I doubt it somehow.
Could you paste us the relevant parts of your apache config, tell in more detail, what urls you are using to log in, what software you are using (if that is the case, e.g. wordpress) and perhaps generally explain more what you are trying to do?
EDIT 1
If it is a PHP related error, try reading the php error log. That log is different from the apache log. Some servers never send error reports to the browser by default and only show a white page. You can find the location of the php log file in your php.ini. Just keep looking for the word log.
I ran into a similar problem.
I narrowed it down to pages that interfaced with the database seemed to result in this message from Apache.
In my case, Oracle had been upgraded to 11g and caused the OCI connections to fail. No PHP or Apache errors were returned which made it rather difficult to come to this conclusion...
Changing the following in the php.ini (and an apache restart) solved the issue.
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client

Categories