I have a site that until a few days ago was working perfectly. It's setup in different sub domains, etching using codeigniter. The main website is fine and working well, however the admin us domain has all of a sudden begun to display 500 errors when I login.
I can access the different areas of it by typing the address eg
However when I return to the main page http://admin.mysite.com it kicks out a 500 error.
In the same way when I try to submit an article to be published on the site the same 500 error occurs. It seems that whenever I need to use a controller it generates a 500 error.
I don't think it's the htaccess, it hasn't changed at all (indeed I've tried to restore the whole domain from backups) and the 500 error persists.
I've toyed with the idea of an apache problem but mod_rewrite is set, indeed as the site on the main domain is still functioning this makes it even more puzzling.
Can anyone push me in the right direction. As ever with these things I hope I'm asking the right questions. I have been trying to fix this for two days straight and I'm at a loss!
EDIT: I have managed to produce an error finally:
Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed
to request report data. Error: "GDatainsufficientPermissionsUser does
not have sufficient permissions for this profile."' in
/var/www/vhosts/dealersupport.co.uk/admin/application/third_party/analytics/gapi.class.php:218
Stack trace: #0
/var/www/vhosts/dealersupport.co.uk/admin/application/modules/analytics/libraries/analytics_lib.php(86):
gapi->requestReportData('20924509', Array, Array, Array, NULL,
'2011-12-23', '2012-11-23') #1
/var/www/vhosts/dealersupport.co.uk/admin/application/controllers/home.php(34):
Analytics_lib->get() #2 [internal function]: Home->index() #3
/var/www/vhosts/dealersupport.co.uk/admin/system/core/CodeIgniter.php(359):
call_user_func_array(Array, Array) #4
/var/www/vhosts/dealersupport.co.uk/admin/index.php(202):
require_once('/var/www/vhosts...') #5 {main} thrown in
/var/www/vhosts/dealersupport.co.uk/admin/application/third_party/analytics/gapi.class.php
on line 218
EDIT 2: And this:
Fatal error: Cannot access protected property MY_Form_validation::$CI
in
/var/www/vhosts/dealersupport.co.uk/admin/application/modules/news/controllers/news.php
on line 459
EDIT3: and for the sake of completeness here is the htaccess
Options +FollowSymLinks +SymLinksIfOwnerMatch RewriteEngine On
Options -MultiViews
Prevent access via browsers to all htaccess files. order allow,deny deny from all
RewriteEngine On
# Shortcut globally accessible design locations, to hide true
location # of these files from users. RewriteRule
^(css|js|images)/(.*)$ application/assets/$1/$2 [L] RewriteRule
^modules/([a-z_]+)/(css|js|images)/(.*)$
application/modules/$1/assets/$2/$3 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php </IfModule>
# Turn off ETags, to improve performance.
Header unset ETag FileETag None
Prevent directory listing. Options -Indexes
Maybe it's not the same issue, but I had in the past some error 500 in CI for some controllers because the encoding of the PHP controller files was somehow corrupted.
The only solution was recreating the controller (new PHP file, copy the code ...).
I had the same problem today and i resolved it by changing in .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Note:
RewriteBase / was important for me.
Related
There are countless posts here and elsewhere requesting help in taking out the public/ and index.php from a fresh laravel install on a live server. So many in fact that I'm a little embarrassed to ask this. However, Given that there is more than one way to skin a cat, I feel that the many different solutions can sometimes conflict with each other and cause more headaches.
I have taken out the "public" in the url from a recently launched laravel site by pointing the virtualhost domainname.com.conf to the public folder.
This however causes the need to put index.php after the domain in all requests or else the page doesn't work correctly.
When I do put index.php into the urls manually, some of the images can't be loaded since they don't have this hardcoded.
Furthermore, if I point the virtual hosts addresses directly to public/index.php, the site works but after about 10 minutes it stops working and nothing on the site will load, css, js images. It all stops. I assume this has somemthing to do with laravel view caches but clearing them doens't change any thing.
At this point I'm at a loss. I've put +8 hours into this off the clock and am getting pretty desperate.
This is my htaccess folder in public(no htaccess in laravel root is needed?)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
This is the same setup I've used for other domains & laravel live sites with success. For some reason the index.php simply won't go away using anyone's solutions.
Any help? Have I been staring at the same htaccess/virtualhost files for too long?
Seems like you don't have the DirectoryIndex properly set.
Check your configuration, in my case I got it on dir.conf file:
file: /etc/apache2/mods-available/dir.conf
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
codeigniter page not found showing but working fine in local server.
I had uploaded codeigniter file of one basic simple page on live server but there it is showing no page found and same file it is working on local server.
In that I had
mine.php ---- controller
index.php --- view
I loaded in routes default controller - mine in config base url- domain.com removed index.php also
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
can I know please why it is showing page not found, might be some routing issue but I had loaded default controller also. Please help out on this
First of all start error logging properly so you can see the actuall error.
Change your file name's first letter capital. This is mendetory as explained here ci3 manual - controllers. It says class name as well as file name must start with capital. ( If your Dev machine is windows then it will not show errors if you don't follow this rule. Because window's file system is case insensitive. But on your server it is linux.so it will show error)
If you still don't get it working then try access the url with index.php in it. Temporaryly disable .htaccess .If you get it working then may be you have problem in . htaccess. Try the following link to properly remove index.php from your url. Expression engine forum .This htaccess worked for me on all different server I have used.
add this in .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !^(index\.php|images|asset|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Hi i am using apache on mac, i have enabled php. I am trying to rewrite my url using .htacess.
http://localhost/~username/project/test to http://localhost/~username/project/index.php?url=test
But received 404 error - on retrieving url - http://localhost/~username/project/test .
But - this - http://localhost/~username/project/index.php?url=test - Php is working fine.
My .htacess file contains these five lines:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
I can see mod_rewrite in loaded modules in php info. How I can debug this to find out whether .htaccess is being called or not.
Path of my .htaccess file is - ~username/Sites/project/.htaccess.
From Troubleshooting
Make sure that you don't have a AllowOverride None in effect for the file scope in question. A good test for this is to put garbage in your .htaccess file and reload the page. If a server error is not generated, then you almost certainly have AllowOverride None in effect.
Or the other way round, add some garbage to the htaccess, i.e.
Foobar
and reload the page. If you get some 500 server error message, htaccess (AllowOveride) is enabled.
I just started using Codeigniter to develop a simple static website using a local server (MAMP). Initially my local address to access my homepage was http://localhost/index.php/home. Even a simple localhost would redirect to my homepage. I wanted to remove the 'index.php' from the URL and hence I copy pasted the .htaccess code which I found online. The code looked like the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
#RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
#RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
# Enforce NO www
RewriteCond %{HTTP_HOST} ^www [NC]
RewriteRule ^(.*)$ http://localhost/$1 [L,R=301]
###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
Initially I copy-pasted the code without changing it at all (which was foolish on my part) So the 'localhost' in the code above was initially 'www.domains.tld'. When I then ran localhost on my browser, it directed to www.domains.tld'. I noticed the blunder and changed it to what it is above and localhost still directs to 'www.domains.tld' I deleted the .htaccess file to reverse the effect but it still does the same thing.
I also changed my root folder for localhost but whatever I do localhost points to 'domains.tld'. When I type 127.0.0.1 on the address bar of my browser, it directs correctly to my website. I have spent hours reading up on the reason for this behavior but am unsuccessful to find a solution.
Any help will be greatly appreciated.
Thanks,
H.
Clear your DNS cache and restart your browser. Certain browsers cache redirects with DNS so that you end up at what it thinks is the correct site more quickly.
Firefox is particularly annoying with this, so I disable its internal DNS caching every time I install. In about:config, create the following two integer type settings (NOTE: you MUST create these, they do not exist by default):
network.dnsCacheEntries set to 0
network.dnsCacheExpiration set to 0
In Chrome, you would need to turn off DNS prefetching under your Privacy settings.
The reason they do this is to make the internet "seem" faster to casual browsers. For developers, it can be quite a hindrance.
I just transferred my local web app to my server, and now I'm getting this error:
Parse error: syntax error, unexpected
T_OBJECT_OPERATOR in
/nfs/c05/h01/mnt/71658/domains/ergo-metric.com/html/application/libraries/Survey_form_processing.php
on line 172
This is odd because it works locally! I changed my db settings to the production server, and my base_url is correct.
Any ideas what this could be?! I'm a little worried b/c this is a live site!
I would start with your php config file, check what is enabled on your end and what is enabled on the other end. but first check your config file and look for rewrite short open tags switch it to true. these are very basic but you didn't give a whole lot of information, maybe post a few lines of code before and after 172 let me see what is going on there. also if you are using htaccess files and are still using the default CI example i would switch it to this works like a charm: this is a universal htaccess file no matter your setup you dont have to change it promise you that the best thing since sliced bread.
# 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 am going to be on for a while if you reply maybe we can get this worked out for you two heads are better than one thing you know