Yii framework blank page issue for many times - php

I am working in yii framework. my site many times problem in blank page issue. i am trying many ways but its not work properly. i am already trying increase maximum execution time. but its not work.its not showing any errors. also trying error_reporting(1);. this error not showing all times.
My htaccess file code is give below.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
How can i solve this blank page problem. Please guide me.

Yii can't handle fatal error (Yii2 support it by using error_get_last() and register_shutdown_function()).
So you should check you php error log and get the reason.

What about check to see if there are any space before or after the <?php inside view , controller, model file.
i mean at the top of the script, since it will output space, and making the redirect not functioning without showing error.
I had mine solved by found this.

I found one of many the solution for this problem. In my case, there is one Controller that can't be redirected but others is good. All script are good, config and others are good too, then i realize when i "Ctrl + a" on my editor that i have so many "ENTER" and "SPACE" and "TAB" after php closing tag "?>". Then i remove that blank space, that's it my "redirect" is working again. I hope it helps.

Related

Wordpress: update and preview buttons redirect to homepage

I have a strange problem with wordpress: every time I try to write / update / preview a post with the code below, it redirects me to the home page.
Here is the code:
$segments = \Uri::segments();
if (empty($segments))
$segments[0] = 'homepage';
Other useful information:
I have last Wordpress version
I've tried cleaning the cache
I've tried with a fresh install
I've tried without any plugin nor any custom theme
All other post works well, even the one with other source code
The error log is empty
Hope you can help because I don't know what else to do.
UPDATE 1
This is my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
UPDATE 2
As I said before, I'm redirected to the home page if I insert that 3 line in the post and then if I try to insert / update / preview a post. BUT, if I copy past on the toolbar the preview link, it works (don't know if it can help)...
UPDATE 3: RESOLVED
Finally found the problem: it was a Mod_Security rule in the server that redirects to the home page in case it happens. Finally it works again :).
Thank again for helping
This might not be the answer you expected, but your code and you .htaccess file look fine and I don't think that this is a "redirect problem".
When you said:
I've removed every template and plugin (deactivating them and deleting the folders) to be sure was not relate to one of them, but the problem was still there.
It sounds like there might be a problem with your server (possibly even wordpress itself).
I think you should report this problem to wordpress, maybe even file it as possible bug.
Good luck and all the best.
Are you able to access to your virtual host file? Maybe a rule on the configuration file is doing the redirect. Also, check your permalink settings, try changing the permalink structure and then see if the preview works.
Additionally, could you add your functions.php theme file so we can take a look at it? Perhaps a custom function is causing this behavior.
If you have previously had a non updated plugin such as rev-slider you may find that your security has been breached and something was modified to prevent you from doing an update. If this is the case there are some things you can do but look at the .htaccess for redirects and also if necessary compare the main files against the release version you have running for little differences. Assume you have tried disabling all plugins and switching back to default theme etc?
You say that you have explored all of these .. I would then be looking to do command line tests using curl or similar to view the headers to see what is going on.
In the options you could try changing to url formatting options (permalink) for posts and pages through WP console - this can help flush through changes caused by templates etc. You can change them back .. there are a couple of places by memory that you can do this but it's been a while so can't give more explicit links.
Your symptoms at a quick glance smell like a permalink setting that has hung around and needs updating.

Network log shows 404 at beginning of load for folders within wordpress site

Within my wordpress site, I have a folder called projects. Whenever I access a page within the projects directory, the first response in the log is a 404. While this appears to have no impact on the page, it seems to mean that search engines aren't indexing these pages, as they first response they get from the page is a 404.
For example:
http://www.caseyrule.com/projects/sounds-of-sorting/
If you open the javascript console and look at the network log, you'll see that the first response is a 404 for the page itself, followed by all the assets of the page loading successful.
I tried adding a line to the .htaccess to exclude that directory from rewrites for the projects folder, but that didn't fix the problem.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(projects) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Any ideas what could be going on here?
Update: I've been doing some experiementing and it seem that the only pages on which I am seeing this error are pages that include wp-blog-header.php, in order to make use of the wordpress functions such as wp_nav_menu and get_search_form.
include dirname(__FILE__).'/../wordpress/wp-blog-header.php';
It is still not clear to me though why this would result in cause the first response from the page to be a 404.
Looking at your log shows that the http response with the 404 status code in the header is the same response that carries all the data.
This in turn show clearly that the 404 status code is not generated by the server because it didn't find the page, it is generated by some php code in wordpress.
You could look through the code to find the header() function, and the debug from there.
Anyway, looking at your website, I cannot reproduce the issue. Either you fixed it, or it was a temporary issue, probaly due to an incompatible plugin or similar.
With birgire's help, I figured this one out:
The fix was as simple as replacing:
include dirname(__FILE__).'/../wordpress/wp-blog-header.php';
with
include dirname(__FILE__).'/../wordpress/wp-load.php';
More information in this thread from wordpress.stackexchange.com

'404 Page Not Found' every page with codeigniter

I used this .htaccess file on my localhost:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
But when I uploaded my site to the ftp, it suddenly doesn't work. I set the base_url. Mod rewrite is enabled. What else can be the problem. My knowledge is very limited, I was already happy, that I programming part, but this server stuff is over my head. But I'm willing to learn it, so if you recommend a place to start, I'm open to that.
So right now only a formatted page comes in, with basic css settings and the 404 message. It's weird, that this message can be created in a form like that, so it means it's not a technical problem, but a settings problem. I googled around, tried more .htaccess files, but nothing works. Thanks for your help!
This is silly. The controllers must be named starting with a big case letter. So the only problem was, that I named my default controller as welcome.php instead of Welcome.php. It was hard to figure out, because it worked on localhost. So this had nothing to do with .htaccess at all. May be valuable to others, so they don't make the same mistake.
I have seen this error when people are using FastCGI - you need to add to the config.php:
$config['uri_protocol'] = "REQUEST_URI";
This clicks everything together - Might not be the answer to this issue but worth a try and others with your symptoms may find this useful.
Thanks,
//P

404 error with Slim - tried everything

I'm trying to build an API for the first time by using PHP to access a MySQL server, and going off of AndroidHive's tutorial here but customizing it to be my own simple API instead of the task manager one listed. My problem is, I can't even get to the part where I test anything (I'm using XAMPP for Mac) because I keep getting 404 errors when I attempt to access a method in my index.php file.
Here's my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
I already changed my XAMPP Apache httpd.conf file to "AllowOverride All" as per the Slim documentation instructions, and tried restarting the server a billion times but to no avail. No matter what I do, if I ever try to test any of the URLs in my index file (for instance at localhost/w_manager/v1/register) it just returns a 404 not found error.
I even updated my .htaccess file to add in "RewriteBase /v1" though that did not seem to make much of a difference - got another 404 object not found error.
I've also looked around on Stackoverflow a ton. I'm about to pull out my hair. Does anyone have any other suggestions? Thanks!
Well, I seem to have fixed it - not exactly sure how, unfortunately, but what I did was go back and copy the sample code into my own and make alterations (after I noticed that the sample code worked.) One major change I made was that in my index.php file, I moved the Slim request definitions at the beginning and moved all other functions to the end, just before $app->run(). Hope this will help someone else!

Making ExpressionEngine .htaccess allow commenting on index.html

I've got a really quirky issue going on with ExpressionEngine. I've got a live test site here.
Essentially, if you attempt to comment on the index's 'Question of the Day,' you get a proper redirect, but the comment never gets to the database.
If I remove my .htaccess and set the site's index page in my control panel to index.php, then all is well. But with the .htaccess and index.php removed, things go haywire.
Here are the comments of my .htaccess file:
RewriteEngine on
RewriteCond $1 ^(weblog|member|search|site|rss|search|contact|show|commentary|include|about|blog|tags|preview|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /skad/index.php?/$1 [L]
Any tips to troubleshoot this or ideas where I could be going wrong? If it's any help, you can see a screenshot of my folder structure.
Thanks so much for any answers or simply help that you can give.
More: Also, here are headers for a successful post on a blog entry and a failing post on the index.
Update: I did recently find something else strange. With identical backend settings:backend settings http://droplr.com/1sMXc9+
And identical code:identical code http://droplr.com/1sN09A+
I get http://localhost:8888/skad as one form action and http://skadaddlemedia.com/v2/v2/index.php as the other form action.
At this point, I'm completely lost as to what is going on.
the "?" after index.php in the RewriteRule suggests that you are on a server running PHP as a CGI script and thus requires the "forced query strings", correct? This may be ancillary to the problem in the question, but it can complicate things to have this requirement. Looks like you're hosted at Site5... I have no experience with them but you might try the workarounds suggested here: http://expressionengine.com/wiki/Workaround_for_Forced_Query_Strings/
Try changing [L] to [L,QSA] to see if it helps.
I'm not sure but i think that CI and EE are pretty much the same as to the way the htaccess works so this may help you out. It is by a CI guru named Ethan, can't remember the last name, but he is very active in the CI community. Anyway the way that your HTACCESS file is has really been abandoned the new way to do it is a lot easier and you don't have to state your excluded folders it is the best thing since sliced bread for users of MVC or any frameworks i just love it.
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
i can gurentee you that if it is a htaccess issue this bugger will fix it but the bext thing is you dont have to do a thing to it just drop it in and you never have to edit it again i swear by it. so freaking good like fried chicken in the summer yummy!
remember test it first by just dropping it in place of your current one you wont need all that crazy other stuff you got there in yours promise.

Categories