codeigniter custom 500 error - codeigniter

At this very moment I do not have any 500 error being thrown, but in case I ever do in the future I'm trying to customize a page so users never see that awful white screen.
I am having trouble adding said page. I have the page made and a controller that loads the page, but when I try and route the page in the route file or route it using .htaccess I'm still getting that white screen.
This is what I have tried in my route file
$route['500_override'] = 'notFoundErrorPage/serverError';
and then this is what I have tried in my .htaccess
ErrorDocument 500 http://writeyourfiction.com/NotFoundErrorPage/serverError
any help would be wonderful!

CodeIgniter does not have any custom error handlers aside from 404_override, so using one for any other HTTP code will be fruitless.
Apache has custom error pages as you've already attempted, but there are a couple of things to note that may be affecting your results:
1: A local URL begins with a /
A local URL to redirect to (if the action begins with a "/").
2: Specifying in an .htaccess may require additional configuration:
It may be used in .htaccess files if AllowOverride is set to FileInfo.
If you seek additional help, either here or elsewhere, please provide more information about your server environment: operating system, web server (e.g. Apache) and version, any relevant add-ons or modifications you may have made, etc.

It depends on the server software you are using. If you are using Apache, see here: http://httpd.apache.org/docs/2.2/custom-error.html
If you aren't using apache, google "[webserver software] custom 500 page".
If you're still having trouble, try asking on serverfault.com.

Related

Magento Backend Catalog page keeps refreshing

I have a magento install on a staging environment, everything is working except the catalog backend page and the frontend layered navigation. Look at the image below. There is a backend within the backend. When visiting the page it refreshes to infinity. See this identical problem
My first guess is there is a bug in the template file but an identical template file on my local machine does not cause any issues. Additionally the database between my local and staging site are identical minus the core_config_url. The only difference is local I am running Apache and on staging I am running nginx.
The second issue which I imagine is related is that the filters on the frontend catalog page dont work. They are visible but clicking on them reloads the page without changing the products.
Any help would be appreciated. Thanks
UPDATE: After switching from NGINX to Apache the issue disappeared. I still would like to figure out what is causing the problem
I take for granted that you had already tried different browsers/clearing your browser cache and Magento cache (empty the cache directory), etc.
Are you sure you put the correct value in the cookie_domain setting? Many users that had your same problem seem to have setted up an incorrect value in that setting.
Take a look here and let me know.
I have found that usually this is caused by a server-side error on the ajax request. If there is any kind of error response returned, it will just continue to spin. Either check your Chrome console for a 500 response, or look in your server's error logs.

Magento: ?___SID=U appearing in some urls

Can someone please explain why ?___SID=U is appearing in some Magento URLs on my site and not others?
I think it has something to do with sessions but I am not entirely clear. Also, what makes it more confusing is the fact that it's only appearing in some URLs and not others.
I don't need to know how to remove it as I am aware of the setting in the admin area. I would really like an explanation of what it is, what its purpose is and why it would show on some pages and not others. id rather understand what's going on fully than blindly follow some advice as to how to remove it.
I addition to Brendan's answer, the ___SID=U is used in the cache as a placeholder for the session ID. It is replaced by Mage_Core_Model_Url::sessionUrlVar() which in turn calls Mage_Core_Model_Url::sessionVarCallback(). These methods are called from Mage_Core_Block_Abstract::_afterCacheUrl(), which means that any URL found in block output will contain the correct session ID (if needed).
So to get rid of the parameter in your own code the "right way" use this:
$url = Mage::getUrl('some/magento/route'); // might append ___SID parameter
$url = Mage::getModel('core/url')->sessionUrlVar($url); // process ___SID
If the string still displays in the rendered page that is a bug. Are you using some custom caching module, or generating URL's using a non-standard way?
The SID is a "session ID". Magento uses this to track a user's activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database).
Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged in while navigating across these websites/stores.
I think if you have the function enabled, the SID is sent when accessing catalog URLs so Magento can update the session with the user's location/state for the current website/store.
If you're not running a multi-website or multi-store environment, it's safe to disable the SID on the frontend.
Just something i come across today and though i make a comment, maybe it will help someone.
I found that Magento will format/create an incorrect product url (inc. Session Id) if there were some errors during processing the page. This is not consistent though.
It worth having a look at your server logs for PHP errors.
This is a general Magento 2 bug which is already reported to magento.
Temporary fix is
Go to Document Root,
Find .htaccess and add
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule ^(.*) www.abc.com/$1 [L,R=301]
below.
This should solve the issue. For me this work in M2.1
All the best.
Reference : https://github.com/magento/magento2/issues/5517
I hunted for hours to find this and the precise answer was a combination of the other answers listed here. First, I cranked up my PHP error reporting and error logging (thanks Gergely Varga). I saw this:
PHP Fatal error: Call to undefined function mb_strrpos() in /var/www/html/app/code/local/ManaPro/FilterAjax/Model/Observer.php on line 59
So, one of our installed extensions requires the php-mbstring package, which my server didn't have installed. As soon as I installed that, the SID=U URLs all disappeared. (In future I'll be running Magento's pre-install checks before copying an existing install over to a new server!)
Thanks to Vinai too for the background of what this tag is for.
Go to Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefrontand and set the value to No.
Clear the Magento cache

Moved Joomla 1.7 Site to New Server. Admin works fine. No pages display

I've just moved a Joomla 1.7 site to a new server.
Administration back-end works fine. Configuration.php seems fine. Get "The requested document was not found on this server." for every page other than Home.
Must be talking to the database OK or I'd get an error. Could this be a problem with the PHP?
Thanks,
Andy
Did you clear joomla cache ?
Disable page and/or module caching.
Disable any plugin that optimizes "loading speed".
Try removing SEF URLs (Joomla! and any 3rd party extension).
If you are using a custom .htacess, then use an unmodified joomla one.
Disable some system plugins.
Disable modules in the homepage.
Have you tried using another template (site) ?
You have Seach Engine Friendly URLs enabled in /administrator/ area's global configuration settings. You have probably enabled the option to use the mod_rewrite function which removes the /index.php/ portion of the urls.
It is a requirement of this mode that you have the .htaccess file in place in the root of your site. You probably had this correctly configured on your development server but perhaps forgot to move the file across when you went live. Some FTP programs hide dot files (files starting with a leading dot in the filename) so depending upon how you transferred the files (I'm guessing manually with FTP rather than Akeeba backup or similar) the file may have been missed. Look through your FTP client's options/preferences for an option to show/hide hidden files.
Failing this - the file could be correctly in place - but if you were developing in a sub-folder on your development server you would have set the RewriteBase line to your /sub-folder/
RewriteBase /sub-folder/
Now you've moved to the live server this line could be incorrect. If this is the case, edit the file to Read
RewriteBase /
Chances are it is one or other of these issues - missing .htaccess file or incorrect RewriteBase. A third and nowadays somewhat more unlikely option is that your server doesn't have mod_rewrite enabled - but I think that would result in server 500 errors.
Check whether you are using any modules that is calling database and you have not changed DB details in that module after migration. If admin panel is working fine then I think problem with some modules that are used in front-end. You can do debugging by disabling few suspected modules and check whether your site works fine or not. Else provide some more information about your site so that I can check further.

Getting 401 error in Joomla backend when trying to login\logout or edit anything

I have a website built on Joomla.Everything seemed to be going fine when all of a sudden I am noticing the following.
When I go to the administrator login page, once I fill my details and press login, I am getting a 401.shtml page with following message -
"Not Found
The requested URL /401.shtml was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8 Server at www.shillingstudios.com Port 80"
Now as per my understanding the 401 error would mean that I do not have the authorization to visit that page or do what I am trying to do.Maybe I am not entering the correct username or password.
However,my username and password are correct.Moreover if I go back to the admin login page I find that I am logged into the administrator panel, which means that my login attempt was successful even though I was directed to 401.shtml page.
The same thing happens when I try to logout(on refresh I find that I had successfully logged out)
When I try to Save/Edit/Close an Article/Category/Section I am redirected to the same page.But in each instance I am actually able to successfully do what I was trying to do.
The only change that I made prior to this issue was installing following plug-ins:
Set Generator tag plug-in
Title Manager plug-in
I installed both plug-ins for SEO purpose from http://extensions.joomla.org/extensions/site-management/seo-a-metadata
I thought that the issue might have caused due to installing these plug-ins so I disabled them, but the problem is still there.
I am trying to setup a website for an Android game that I am developing and Joomla seemed a good option for creating my own website. However I do not have much idea about PHP or MySQL or how Apache server works.So I am not able to determine why this is happening and what can possibly fix this, so any help will be appreciated.
You could try making sure that your website URL is in the 'live site' field in the config.php file. That can sometimes help.
First you should create your custom error pages – you can use a text/HTML editor of your choice (for example Dreamweaver). Once you are ready with the pages, upload them into a subdirectory of your public_html called errors. Then open your main .htaccess file and add the following lines in it:
serve custom error pages
ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
Important settings:
Search Engine Friendly URLs: Yes
Use Apache mod_rewrite: Yes
Mod_login settings: All defaults from installation
edit:
I did rename htaccess.txt into .htaccess

URL Rewrite with Joomla on IIS7

I have Joomla 1.5.9 running on IIS7. I'm now experimenting with the SEO Settings from the Joomla global configuration page.
First I toyed with Search Engine Friendly URLs (that gets rid of the queries part of URLs); that works fine.
I also tried to enable the "Use Apache mod_rewrite". I installed "Microsoft URL Rewrite Module for IIS 7.0" and added the web.config as per http://learn.iis.net/page.aspx/527/joomla-on-iis . When clicking on menu links, this seems to work in that I no longer see index.php in the URL. The address bar updates to what appears like the right URL, but the content shown is always that of the home page. I tried both in IE and Google Chrome with the same result. Refreshing the page after loaded made no difference.
I tried re-starting IIS7, it didn't make a difference.
Edit: After I followed the suggestion below (followed instructions at http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx :turned on fast cgi, modified php.ini, and imported rewrite rules instead of putting them in a web.config myself), I now get 404's instead of just showing the home page's content. The URL still appears to be correctly rewritten. So, different behavior but still doesn't work. I'm not sure this is useful information, but these two fields are shown in the 404 page:
Requested URL http://localhost:80/joomla_course/seasonal-specialties
Physical Path C:\inetpub\wwwroot\joomla_course\seasonal-specialties
Should the physical path be the 'non-rewritten' URL? Or is it expected that that it be like this?
Edit 2: Oho! I found someone with the same issue posted on Joomla forums: http://forum.joomla.org/viewtopic.php?f=543&t=364706&p=1598137#p1598137 . No answer there either, though.
Any idea on how to diagnose (or even better, fix :) ) this?
Thanks!
I got this to work now. The key was to make sure FastCGI is used to run php (as per http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70 ), and making sure that the "Use Apache mod_rewrite" is enabled. If "Use Apache mod_rewrite" is turned off but the rewrite rules are present in IIS7, then the HTML shows up but none of the styling or images.
The requirement for using FastCGI is weird (and contradicts what is suggested in http://maximumpcguides.com/windows-vista/how-to-create-a-windows-vista-iis7-mysql-php-web-server , which is what I used to setup php in the first place). Everything seems to work when not using FastCGI, except for the URL rewriting.
It seems that either importing the rules (as suggested in http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx) or manually adding them to a web.config file (as suggested in http://learn.iis.net/page.aspx/527/joomla-on-iis ) will work.
It looks like there is something wrong with the rules in the web.config. Just going from a comment on the article you linked you are not the only one having this issue. I would remove the web.config and then follow the steps outlined here.

Resources