Wordpress changes are visible only to logged in users - php

So here is an unbelievable issue , i am working on wordpress but the problem is if i changes the content in the template file the changes are visible only if the user is logged in . no condition in the template .
for try i have created a template check.php and put the content only
<? echo "hieeee" ; ?>
assigned this to a page , first time it shows me the correct content for both conditions, but if i change the content like
<? echo "hieeee this is update " ; ?>
for logged in user it will show hieeee this is update and for logged out users hieeee can't understand where is the issue .
PHP Version 5.5.16 | mysql client 5.0.11 | SunOS wp1.superhome.com.au 5.11

its solved There was a plugin Nginx Helper which store the cache on server. Thanx all for your efforts

This is definility a caching issue. First I thought it was a caching plugin, but it seems like you have full control of that. It worked locally but not on production server, so it had to be something on the server.
Taking a closer look at the phpinfo() you've supplied, superhome host is using Zend OPcache v7.0.4-dev
You could try to disable the cache temporarily by doing:
If PHP runs as an Apache module, use .htaccess file: php_flag opcache.enable Off
If PHP runs as CGI/FastCGI, use .user.ini file: opcache.enable=0
If you have access to php.ini, try to disable it that there.
UPDATE
It seemed you find the actual answer that there was a plugin messing it up, but if someone else stumples upon the same issue this answer might help.

Related

PHP session.save_path ignored

I was having problems with my PHP website (SuiteCRM) not being able to log users in and I found it was due to not being able to write on the sessions directory.
I am able to fix it by creating the directory /tmp/php_sessions and giving it write permissions for the Apache user www-data. I see the directory get populated with files as users log in.
However, Ubuntu Xenial is deleting my entire tmp directory on reboots, so I have to redo this all over again every time. I decided to move my save_path elsewhere.
After changing things in my php.ini file, and restarting Apache, I can check that they are effective by running this simple script:
<?php
echo ini_get("session.save_path");
phpinfo();
?>
This shows me a double confirmation of the new path, first echoing /var/tmp/php_sessions and then, in the middle of all the phpinfo information, showing the same value as both Local Value and Master value for directive session.save_path.
BUT the directory that php is using is still the first one, /tmp/php_sessions! It seems that my setting is being ignored.
Am I overlooking something? Where could that old setting be buried? Or how can I make the new one effective?
(P.S. - I am not using a redis handler as in another similar SO question)
Ok, I solved my own problem and the general answer is as follows:
There are two more things that can be changing the path and need to be checked,
the PHP code of the application might be changing the ini directive, search the code for ini_set(session.save_path
the PHP code might be using the session_save_path PHP command to override the ini. Search the code for that also (and notice the two underscores _!)
And the specific answer for my case was that SuiteCRM uses session_save_path command to set its path with a value coming from the file config.php found at the web root. That's where I found the old setting, and changing it solved my problem (for good, I hope).

ERROR: The file 'wp-config.php' already exists

I clicked on the 'Update WordPress' link in the admin dashboard of my WordPress site, and I am getting this error:
"The file 'wp-config.php' already exists. If you need to reset any of the
configuration items in this file, please delete it first. You may try installing now."
When I try to click the "installing now" link, it seems that WordPress is installing fresh. I want to keep all of the content of my WordPress installation.
I have tried to change the name of the wp-config.php file but that didn't do anything.
Is just a browser cache.
On first URL load, you are redirected from domain.ext to domain.ext/wp-admin/setup-config.php
If you are on Chrome, just open the developers console, go to "Network" tab. Reload the page and right click anywhere in the console, and hit "Clear browser cache".
Now refresh again and you will see your website
I ran into this same issue while I was transferring a site. The issue ended up being with the .htaccess file. I fixed it by resetting my permalinks. There may be other causes to this issue but this worked for me:
Click on General => Permalinks
Click Save Changes (to reset permalinks)
Try to display the website first on the incognito tab. If it works correctly, clear the browser cache.
Once the page refresh has been completed, the website will appear.
You can use the following shortcuts to clear the browser cache.
Windows: Ctrl + F5
Mac OS: CMD + Shift + R
This usually happens when you use an old version of Wordpress files or old database, and you use partly new files of Wordpress.
All you need to do is to delete all WP files and install a fresh Wordpress (new files unzipped from a new version of Wordpress) and use an empty database.
If you're planning to migrate or move from another website, you should use the export/import function built in wordpress.
he file wp-config.php already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now.
Answer:- Please Clear Your browser's cache.
Did I miss the party?
Today I have a problem like what you experienced 5 years ago. The solution is: Remove all caching plugins (Cloudflare, Jetpack, Litespeed).
Maybe you could try to delete 'wp-config.php' file, or take a backup of this file in different folder and then try again.
If you are using bluehost and did not do the one click install :
I solved this problem by deleting the default error pages 404.php 500.php etc...
I do not know why exactly this was causing this issue... Sorry for the sloppy answer but tried clearing cache and recreating the .htaccess file it didn't work.
I removed the added spaces that the Wordpress's own web 'easy installer' created in the wp-config.php file to help me out.
Guess the Wordpress's own wp-config.php ?checker? isn't compatible with Wordpress's own installer. Wow.
Once the added spaces were removed, site comes up fine. I simply modeled the spacing that is in the wp-config-sample.php file.
Because you just installed wp.
Just hit ctrl+F5 done!!!
More likely it is cache issue and this error comes when we try to install one Wordpress inside of another sub folder of the cpanel in the same Wordpress installation and it will be mostly resolved when you try to check it in the private window or another browser
For me it was file permission set to 666 changing it to 664 worked.
If someone is still for a solution.
This happened to me on an existing site while trying to update.
the problem was following line in wp-config.php near the end.
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-admin/setup-config.php');
Removing this fixed the problem.
Hope this helps.
RESOLVED: I had the same problem. post hack situation on other account, shared hosting and server NUKED. Luckily I had the backup files from one of the WP plugins but the main page didnt load, I could only go to 404 and from there to other pages but not main page, the error was wp-config eists...install...blah blah blah.....so I tried everything, multiple re-installs, changed the wp_prefix as per previous install on the fresh install and nothing helped, even ordered paid support from the backup plugin developer as I was sure that it fooked because I had Opencart also installed there but the backup was intended for WP only, my web developer also did something, perhaps removed the OC bits from DB, but thank god i managed to resolve it on my own(and justhost),. so I contacted the justhost for the SECOND TIME and they told me that the account is on VARNISH i.e. some sort of automated cache limit, so I told them to take it off and they wanted to know what have I done to reduce the LOAD to the server, so I told this and that and two seconds later everything loaded perfectly. took me about 20 hours to get main page loading, plus probably it will take 10 hours for fine tuning of the site. anyway if you contact jour host make sure you ask them if they are not blocking cahce as the first time I got in contact they couldnt help me.
I also meet with same error and Mr Pierre R is right its just a cache. Just clear your cache or check in private window. All fine.
if someone have still this error..
goto->admin->setup.php (delete this file error will be solve)
hope this will help.

Viewing a PHP after uploading on Filezilla

This is my first time I use Filezilla and ftp. I uploaded my files.php. After I entered the hostname on address bar, I could see which files I had uploaded.
The interesting part comes here: When I clicked on index.php to view, It displayed only the html parts.
When I opened page source code, I saw that my php was commented, like this:
From what I had originally written:
<?php include '/includes/php/menu.php'; ?>
it became:
<!--?php include '/includes/php/menu.php'; ?-->
If anyone could help me I would appreciate it. Does any of the above has anything to do with host properties? From what I read, it supported php.
Your host may support php, but that does not mean that PHP is enabled. You can perform a very simple test to find out.
Create a file named test.php and drop one line of php in it and save it:
<?php phpinfo(); ?>
Upload the test.php file to the server and point your browser to it. It should output a bunch of information about the web server if PHP is working.
If not, check your host admin (cpanel) to see if you can enable it yourself. If you don't find it, just submit a ticket to have your host enable it.
PS: Remember to delete the test.php from your site as it is not great for security to leave it there.
UPDATE:
It sounds like you don't have Includes module installed. If you are using Apache, make sure the Apache Module mod_include. To check if you have the module installed you should create a file called phpinfo.php and upload to your server root and it should include the following code:
<?php
phpinfo();
?>
Then load phpinfo.php in your browser and mod_include should be included in the section Loaded Modules. It would be highly unusual if it wasn't there, as it is the default to have it installed on most Apache systems. If you are not on an Apache server, you can still follow the above instructions.
You can set the default editor to view/edit files under Settings->File Settings->Filetype Associations. An example using Notepad is below. There is also a box to inherit system filetype associations and I have it checked.
txt C:\Windows\System32\notepad.exe
php C:\Windows\System32\notepad.exe
I wanna thank all for your support. I am rather newbie in PHP and with you advice I have learnt a lot in the process. I have low rep so I can't give good rates to your answers.
The problem consisted in ftp, but later after changing some options in the host everything went OK. I guess working with PHP offline differs from online.
Thanks a lot everyone

Drupal 6 Clean URL and urls returning Not Found

My drupal site was working fine on local, when I uploaded it to testing server. It started causing problems
First is its Clean URLs are now disabled . Can not enable it its saying
Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.
Secondly few links are not working, like if I click on Administrator on top it gives me error page Not Found.
http://192.168.5.19/poa/admin is not working , but if i add ?q manually it works. this is working . http://192.168.5.19/poa/?q=admin
I read a lot. tried rewrites but nothing worked.
This is because my htaccess was not being read. To make it work edit conf/httpd.conf and set AllowOverride to All from none. Relaod using this in command line "service httpd reload". And all will start working. Now go to Clean URL option and enable it from Drupal.
Fire this two query in your drupal database:
UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';
DELETE FROM cache;
and write
$conf['clean_url'] = 0;
in the settings.php end of the page.
This should work.

Session data working on local but not on ipage server

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');

Categories