CodeIgniter 500 Internal Server Error - php

I downloaded a PHP script written using CodeIgniter. when I run it from the localhost, on going to the admin folder, it shows localhost again. Also when running from my web host, it shows a 500 Internal Server Error.
I run the site from http://localhost/myproj It works. Then when I try to go to the admin page which is at http://localhost/myproj/administrator, it gives a 500 Internal Server Error.
I read here that this might be due to a wrong code in the .htaccess file. This is my present .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
Please help me. I know it might be a very small problem, but I'm unable to find the error.

The problem with 500 errors (with CodeIgniter), with different apache settings, it displays 500 error when there's an error with PHP configuration.
Here's how it can trigger 500 error with CodeIgniter:
Error in script (PHP misconfigurations, missing packages, etc...)
PHP "Fatal Errors"
Please check your apache error logs, there should be some interesting information in there.

Just in case somebody else stumbles across this problem, I inherited an older CodeIgniter project and had a lot of trouble getting it to install.
I wasted a ton of time trying to create a local installation of the site and tried everything. In the end, the solution was simple.
The problem is that older CodeIgniter versions (like 1.7 and below), don't work with PHP 5.3. The solution is to switch to PHP 5.2 or something older.

You're trying to remove index.php from your site URL's, correct?
Try setting your $config['uri_protocol'] to REQUEST_URI instead of AUTO.

Try this to your .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule >

Make sure your root index.php file has the correct permission, its permission must be 0755 or 0644

remove comment in httpd.conf (apache configuration file):
LoadModule rewrite_module modules/mod_rewrite.so

Whenever I run CodeIgniter in a sub directory I set the RewriteBase to it. Try setting it as /myproj/ instead of /.

I know I am late, but this will help someone.
Check if rewrite engine is enabled.
If not, enable rewrite engine and restart server.
sudo a2enmod rewrite
sudo service apache2 restart

if The wampserver Version 2.5 then change apache configuration as
httpd.conf (apache configuration file):
From
#LoadModule rewrite_module modules/mod_rewrite.so**
To ,delete the #
LoadModule rewrite_module modules/mod_rewrite.so**
this working fine to me

Pretty late to the party but, i think the best approach to 500 internal server errors in CodeIgniter would be to enable the error log functionality in the Config.php file in the config folder and set a threshold value i.e. $config['log_threshold'] = 1,2,3,4 depending on the logs you want to view.

This probably isn't relevant any more to this thread, but hopefully helpful to somebody.
I've had 500 errors for the past hour as I had a controller return an array not supported by the php version ran on my (crappy) server. Seems trivial but had the hallmarks of a codeigniter error.
I had to use:
class emck_model extends CI_Model {
public function getTiles(){
return array(...);
}
}
Instead of
class emck_model extends CI_Model {
public function getTiles(){
return [...];
}
}
Cheers

This works fine for me
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule >

If your are using local server, this problem is faced in Wampserver when the essential modules are not enable.
You can Enable them with:
Left click on Wampsever icon
Go to APACHE -> APACHE MODULES
scroll down and find "rewrite_module" and "headers_module"
Then mark them check
It will restart automatically. Done.

Related

Codeigniter - getting 404 Not Found error

We have two hosting packages at godaddy. Our live website is working fine using following .htaccess file. Website is accessible without using index.php in url.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
We used same htaccess file and same code on other hosting that is also by godaddy. We just wanted to make production and development instances seperate. But on other hosting with same code and htaccess file, website shows 404 page not found error but website works fine with index.php in url.
We have same php version on both server. Just wants to know what could be the issue?
I also faced the similar problem when I move my 100% working code to dedicated Debian server. After 3 hours of research, i found out why htaccess file is not working.You need to allow overriding of htaccess in Apache Configuration.
Here are the steps.
Step 1:
Add this in htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
Step 2:
Remove index.php in codeigniter config
$config['index_page'] = '';
Step 3:
Allow overriding htaccess in Apache Configuration (Command)
sudo nano /etc/apache2/apache2.conf
and edit the file & change to
AllowOverride All
for www folder
Step 4:
Restart Apache (Command)
sudo /etc/init.d/apache2 restart
Before you make any changes in apache2.conf file make sure to make a backup copy of that file. If you are using Debian server you can avoid sudo command. I believe you know how to connect to your server using ssh client software like putty. Comment below if this method does not work for you.
Follow this
Create a new .htaccess file in your public_html/Project root
Paste the following code
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|resources|robots\.txt|static) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?$1 [L,QSA]
Optional
If you can ssh into the server using command ssh username#ip_address on a command line either Linux terminal or Putty
The username is the one given to you by GoDaddy or you can use root
The ip_address would be the Public IP to your host you can find it in your hosting panel
Run the command sudo a2dissite 000-default
The command disables the default apache config that handles request
Goodluck!
You can use this. This works for me in godaddy hosting.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1
try this one.. it's works for me..
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
I have faced the similar problem when I move on godaddy server.And It's work for me.
Add this code into your .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
In config file:
$config['base_url'] = 'domain.com';
$config['index.php'] = '';
And Set AllowOverride to All in your httpd.conf
set the correct permission on the /cache folder, rather than just making the folder writable you need to make it reclusively writable.
I hope it will work for you.
Try to lowercase all your controllers. This fix the problem for me.
in index.php you echo "test" and run .then you can check whether it is called or not.
in config file enable error log .
Make your /application/logs folder writable.
In /application/config/config.php set. $config['log_threshold'] = 4;
check the log /application/logs folder
I have limited knowledge in server networking but this should give you a few ideas.
First ,you must know what is .htacess file is. you can check it here link
.htaccess is a configuration file for use on web servers running the
Apache Web Server software. When a .htaccess file is placed in a
directory which is in turn 'loaded via the Apache Web Server', then
the .htaccess file is detected and executed by the Apache Web Server
software. These .htaccess files can be used to alter the configuration
of the Apache Web Server software to enable/disable additional
functionality and features that the Apache Web Server software has to
offer. These facilities include basic redirect functionality, for
instance if a 404 file not found error occurs, or for more advanced
functions such as content password protection or image hot link
prevention.
Basically .htaccess is giving you permission to edit the configuration of Apache Web Server. You will gain permission using .htacess if mod_rewrite is enabled in Apache. I will not write what that 4 basic line in .htaccess can do in codeigniter because you can find it in google. this link can give you some nice basic info.
Now the main issue is .htaccess is not working in your other hosting. This is possible because a few reason :
For some reason, mod_rewrite is disabled in your Apache Web Server. If your hosting is VPS or DS it's possible you are didn't configuring it yet. Someone already ask how to enable mod_rewrite, you can go to this link. If you are using Shared Hosting, ask your hosting to enable mod.rewrite in your host. You can check if mod.rewrite enabled or not in your hosting following this link. Or you can simply check with <?php phpinfo(); ?> and check in "Loaded Modules" for mod_rewrite exist or not. Example in this image.
You are not using Apache as Web Server. There are others Web Server as NGINX and lighttpd. You should ask your server administrator what Web Server are you use currently. I dont have any experience using NGINX and lighttpd so i cannot give you any help in that. But as far as i know .htaccess code is different in APACHE, NGINX, and lighttpd. You can try to convert .htaccess apache code to nginx code in here or here. For converting .htaccess to lighttpd unfortunately, i cannot find any online converter but there are official guide here and here
Well for the complete tips sake i will write this. It's possible you are not configuring codeigniter to not use index.php. In config file, empty configuration for index_page. and give Base_url your domain name. $config['base_url'] = "yourdomainname.com"; $config['index_page'] = '';
I hope this clear your confussion why your .htaccess didnt work.
As you mentioned here, on localhost your code is working fine but when you moved it over live server it causes 404 error. There might be few cases you need to check:
Step 1: Check mod_rewrite is enabled or not in your Apache configuration
Step 2: Remove index.php in codeigniter config as #geordy suggested
You can check it by
<?php
echo 'Test'; die;
?>
in your root index.php. It ensures your all requests should go through this files else Codeigniter framework would not work properly.

Error with .htaccess mod-rewrite

I get error 500 Internal Server Error when using the below lines in .htaccess file in the main directory of the website.
RewriteEngine on
RewriteRule ^ar/?$ index.php?lan=ar [L]
RewriteRule ^en/?$ index.php?lan=en [L]
My intention is load website.com/index.php?lan=en when entering website.com/en. What could be the issue here?
Have you check if the mod_rewrite is enabled on your apache server ?
If you are on Windows, check the httpd.conf file inside the apache/conf directory on your web server.
On linux like Debian / Ubuntu, check if there is the file rewrite.so in /etc/apache2/mod-enabled/ directory. Otherwise, add the module with the command a2enmod rewrite && service apache2 restart
I am also not seeing an issue here might be some other rule or conflicting htaccess, but you can do that easily by,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?lan=$1 [QSA,L]

RewriteRule creating 500 Internal Server Error

I have the following in my .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^directory/(.*)$ directory/index.php?id=$1
What I'm trying to achieve is this:
When the URL www.example.com/directory/10 is visited, the page www.example.com/directory/?id=10 is displayed on the browser without altering the appearance of the URL.
The above code creates a 500 Internal server error though.
Does anyone know where I'm going wrong?
Your code is guaranteed to generate 500 internal server error because it is causing infinite looping. Reason is that your matching URI pattern is: ^directory/(.*)$
Which matches your URLs before and after rewrites. And once it reaches max allowed internal rewrite limit Apache throws 500 internal server error and bails out.
Change your code to this:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^directory/(.*)$ directory/index.php?id=$1 [L,QSA,NC]
Above code has an extra RewriteCond %{REQUEST_FILENAME} !-f that will make sure to disallow subsequent execution of RewriteRule after first time since /directory/index.php will be a valid file.
I have got the same issue and found that "rewrite" module is not yet enabled in my case. So I need to enable it and then restart apache server:
Enable "rewrite" module: sudo a2enmod rewrite
Then restart apache server: sudo service apache2 restart
Hope this will help anyone.
You should try adding a forward slash to the front:
RewriteRule ^/directory/(.*)$ directory/index.php?id=$1
I've been caught out with that before.
Alternatively use the RewriteLog and RewriteLogLevel to debug, and look at the Apache error and access logs for further info:
RewriteLogLevel 3
RewriteLog ${APACHE_LOG_DIR}/rewrite.log
That will leave a log file in your apache log directory. In my case that is /var/log/apache
If you are using CodeIgniter and is in error problems 500. Follow the solution.
So to delete the segment "index.php" of URLs in CodeIgniter, you need to do 2 things. The first is to edit the /system/application/config/config.php file, changing the value of index_page policy to empty:
$config['index_page'] = '';
The second step is to create a file .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
And that's it! From now on, the URLs of your site/system made with CodeIgniter will no longer have the thread (called "annoying" by some) "index.php".
Another day searching for a strange error on Apache.
Working on my Docker Apache 2.4.48 alpine container. But not in production.
Here is the difference (just a dot):
Not working on hosting provider
RewriteRule ^public/(.*)$ ./public/index.php?route=/$1 [L,QSA]
Working on hosting provider
RewriteRule ^public/(.*)$ /public/index.php?route=/$1 [L,QSA]
Just uncomment #LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
Because by default it was disabled/commented

CodeIgniter PHP Apache 500 Internal Server Error

I did a project in CodeIgniter. It's working fine on my localhost, but giving "500 Internal Server Error" on the remote server. This is my .htaccess file content:
RewriteEngine On
RewriteBase /ezgov
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Open httpd.conf generally located in Apache installation directory in windows
/apache/conf/httpd.conf
and
/etc/httpd/httpd.conf
in Unix based systems. httpd.conf is an Apache configuration file which stores various information about the server.
Search for the module mod_rewrite.so or (mod_rewrite.c in rare cases). mod_rewrite module is developed to rewrite the requested URLs on the fly. Most of the time you will find in commented state.
#LoadModule rewrite_module modules/mod_rewrite.*
Here # character represents that it is commented or disabled.
LoadModule rewrite_module modules/mod_rewrite.*
Remove # and restart the Apache Http Server using the command apache -k restart in windows or service httpd restart in unix systems. You also use XAMPP/Wamp UI to restart Apache in windows systems.
Next create .htaccess file in root directory where your CodeIgniter project is located and paste following code
# index file can be index.php, home.php, default.php etc.
DirectoryIndex index.php
# Rewrite engine
RewriteEngine On
# condition with escaping special chars
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
Next Find CodeIgniter configuration file, generally located in it's configuration directory.
./application/config/config.php
Open the file and make $config['index_page'] value empty. which looks like this
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
Now the story is ended. Everything should work fine. You can find more information about httpd.config at Apache Module mod_rewrite. Hope this helps you. Thanks!!
Posting this, just in case it helps somebody...
Other answers to this question assume that you have access to apache's configuration files. But if you are on a shared hosting platform and do not have access to directories other than the ones where you are supposed to host your files: the trick was to force php to throw all errors even if apache could not.
Open "index.php" that resides in the root folder of your codeigniter installation;
/*switch to development environment*/
define('ENVIRONMENT', 'development');
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
/*added line below*/
ini_set('display_errors', '1');
break;
......
Making the above change immediately started displaying what was wrong with the code and I was able to fix it and get it up and running.
Don't forget to set your codeigniter environment to "production" once you're done fixing it.
It's likely that the reason is explained in the error_log. Is there an error_log in the root directory of the web site? Is there a logs folder somewhere else? The reason will be detailed in there.
try this out :
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
Probably you have problem with your htaccess file. It's helped me as well.
I solved this error.
I was given different database name, I have changed with following steps:
I have created database in server using cpanel
I have created a user
I have assigned the previously created database to user
I changed database settings with username and dbname etc.

.htaccess issues: No input file specified

Can someone help me with this? I'm feeling like I've been hitting my head against a wall for over 2 hrs now.
I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htaccess with the code below works fine, no errors.
RewriteEngine on
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
The same code on my hosting provider server gives me a 404 error code and outputs only: No input file specified. index.php is there. I know they have Apache installed (cannot find version info anywhere) and they're running PHP v5.2.8.
I'm on Windows XP 64-bit, they're running some Linux with PHP in CGI/FastCGI mode. Can anyone suggest what could be the problem?
PS. if that's important that's for CodeIgniter to work with friendly URLs.
Update1:
mod_rewrite is installed and on.
What I've noticed is that if I change in RewriteRule to /index.php?$1 (question mark instead of forward slash) it goes into an infinite loop. Anyway, using question mark isn't an option as CodeIgniter (required) is not going to work this way.
Homepage also works when I request index.php directly: example.com/index.php
I'm starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?
Update 2:
I was wrong.
Apache handles these URLs correctly.
Requesting http://example.com/index.php/start/ (homepage) or any other valid address works.
Seems that Apache is just not forwarding the query for some reason.
Update 3:
Just to be clear what I'm trying to achieve.
I want to rewrite addresses like that:
http://www.example.com/something/ => http://www.example.com/index.php/something/
http://www.example.com/something/else/ => http://www.example.com/index.php/something/else/
I was beating my head up against this as well. I'm also installing Code Igniter.
The goocher was no RewriteBase. Here's my .htaccess:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
The Problem
I encountered a similar problem just now and unfortunately none of the answers in this thread helped:
Zend Framework was giving out "No input file specified.", but:
The default RewriteBase was just fine, and adding RewriteBase / did not help
It's a shared hosting server and only FastCGI is available (no ability to switch to SuPHP)
AcceptPathInfo was on
There was no problem with URL rewriting in general on the server
So the answer came from the following site:
https://ellislab.com/forums/viewthread/55620/P15 [dead link]
(even though the host is not DreamHost).
The Solution
Apparently all you need to do is replace this line:
RewriteRule ^(.*)$ index.php/$1
With this:
RewriteRule ^(.*)$ index.php?/$1
Problem solved.
This worked for me:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
After index.php, the question mark is important!
Try if it works with a simpler RewriteCond; like one that rewrites only everything that isn't an existing file/folder/link:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /index.php/$1 [R,L]
Go Daddy Users:
login to your Go Daddy Account
click on your hosting account.
go to Settings > File Extensions Management
change .php and .php5 to run under PHP5.2X (instead of PHP5.2xFastCGI)
SOLVED!!!!
mod_rewrite is a bit too smart for its own good, because it tries to figure out what sort of redirect it should be doing. In this case it looks to mod_rewrite like you're trying to redirect to a folder, so it looks for the folder and can't find it, hence the error.
Edit: Just to be perfectly clear I think your best bet is to change your rewrite rule to:
RewriteRule ^(.*)$ /index.php?$1 [L]
unless there is a very speciic reason why you want it to be a forward slash.
Edit 2: I see that you already tried this. The reason you're getting an infinite loop is because you have index.php in your rewrite condition. If you remove that you should be free of the infinite loop.
this code will fixed this issue.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
.htaccess for Live Server :-
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
.htaccess for Localhost :-
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1
It is very likely that the administrator of your host has disabled the ability to use Rewrite in .htaccess. They might not even have mod_rewrite installed.
Drop them an email and ask
Since this is a server configuration issue, perhaps you should ask at Server Fault
Edit (since you are sure that the server is configured correctly)
Have you considered tagging your RewriteCond with an end of line $?
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)
Will (based on my limited knowledge) block any url that contains index.php, css, gfx ... at the start of a url. Because you don't have a $ at the end of the regexp, it will also block any urls that continue on from there...
I.e www.yourdomain.com/index.php/something is not redirected, same with www.yourdomain.com/js/something
Perhaps you want to add a $, which will require the url to end immediately after your regexp.
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)$
Here is one time I caught no input file specified right on action:
This causes it:
RewriteRule ^(.*\.swf)$ redirect_php.php/?a=1 [last]
This corrected it:
RewriteRule ^(.*\.swf)$ redirect_php.php?a=1 [last]
note the / before query ?
This seems really related to AcceptPathInfo, which is about the ability to read paths after file names:
http://domain.com/file.php/tricky_path/?regular_query_stuff
Since this question seems to attract a lot of attention I'd like to propose another answer for people having encountering the same problem and are unable to solve it with the help of the existing answers. I myself was one of those people until five minutes ago.
Always, I mean always check your server logs because they might present useful information to you.
After checking my server logs (Apache2.4) I found out that open_basedir caused the trouble:
mod_fcgid: stderr: PHP Warning: Unknown: open_basedir restriction in effect. File(/data/sites/domain/public/index.php) is not within the allowed path(s): (/usr/local/lib/php:/usr/local/bin:/data/sites/domain/http-docs) in Unknown on line 0
mod_fcgid: stderr: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
In this case, open_basedir could not handle a symbolic link I created because it points to the outside of the open_basedir settings. Either broaden the open_basedir setting to also the new location or move the required files to the inside of any allowed directory..
You may be using Nginx, not an Apache. The error message will be the same.
echo out your sever data to be sure.
echo $_SERVER["SERVER_SOFTWARE"];
I spent hours trying all recipes from SO until I found the solution: you have to add question mark (?) after ".php", so last line of your rewrite rules will look like:
RewriteRule ^(.*)$ index.php ? /$1 [L]
There was no ? In my CodeIgniter setup from previous server, cause it usedpure Apache (no Nginx). And no recipes with port forwarding, nginx reconfiguration or php-fm reinstallation helped -- I tried them all on my VDS.
That simple method solved all in seconds.
In my case, the rewrite engine was conflicting with the doc_root directive in php.ini. The rewrite engine was treating the rewritten URL as a local file path and prefixing it with the document root, only to be prefixed again by PHP.
The solution was to rewrite to a relative URL, and add the PT flag. This tells mod_rewrite to pass the result to normal URL processing.
RewriteRule "^/(unwanted-part)/(.*)$" /$2 [PT]
In my case I am running laragon it's happening due to php.ini file, then I removed the php and install it again and it worked successfully. I think made some changes in php.ini file that's why it's displaying no input specific. After installing php.ini it fixed my issue.
update php.ini
Maybe your server has AcceptPathInfo disabled that is essential for that kind of URL to work properly. Try to enable it:
AcceptPathInfo On
Ok, try this rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^index\.php(/|$) index.php%{REQUEST_URI} [L]

Categories