Codeigniter, URL Routing is failing - php

With a codeigniter codebase I've inherited, I'm attempting to get url routing up and running but it only seems to throw 404 errors.
When I go to http://root_url/index.php it hits the default controller/method just fine, however when I request any specifically controller/action, it 404s.
If I request http://root_url/index.php/auth/login apache throws
File does not exist: /var/www/ci_project/index.php/auth/login, referer: http://root_url/index.php
It looks like apache is trying to request a folder that obviously doesn't exist instead of supplying the uri segments of auth/login to the index.php
Notes:
I'm not using any htaccess file(the codebase should work without one)
mod_rewrite is enabled and is detected by php though I suspect the problem is occuring before hitting php
I'm using debian(w/ apache 2.2.2) as opposed to ubuntu(2.2.14) where it does work
Query string arguments work fine, it's just the URI segments
I'm not attempting to remove index.php, just get the basic controller url matching working

It actually turned out to be an apache configuration issue on debian and nothing particularly to do with codeigniter at all.
I did a purge/re-install of apache and that appeared to fix the issue.
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
My only guess as to why the problem occured is that I had
the libapache2-mod-php5filter(which I didn't realise till purging occured) instead of the libapache2-mod-php5 package installed and it simply didn't handle the urls correctly.
Thanks for the help.

Related

How to connect php-fpm with nginx?

I have a server that uses Nginx and PHP-FPM. It was working as well, I executed the following command for some reasons:
apt-get --purge remove php-common
After that, I executed this:
apt-get install php-common php-mysql php-cli
Commands executed successfully, but I get 502 error when I want to access websites on the servers:
It should be noted, there are several projects on this server. And I have nothing inside /etc/nginx/sites-available. I have all configurations under /etc/nginx/conf.d. See:
Each of them is a project. Now, I guess I need to set to PHP-FPM to use conf.d instead of sites-available. Any idea how can I do that?
Could you please help me how can I debug it?

Apache2 cannot open .php files

I installed lamp long time ago and was able to execute php files. However, recently I tried to install cakePHP and ran into trouble (restarting apache started to generate errors). Thus I purged apache2 from my system. I reinstalled apache2 using command "apt-get install apache2" but after doing so it could no longer open .php files, shows a blank page instead. I've set the necessary permissions (given -R 777 to /etc and /var/www). I've also ran the command "apt-get install php7.0 libapache2-mod-php7.0" and restarted apache several times, nothing works. Can anyone help?
PS: I was originally trying to run phpmyadmin, before purging I was able to run it but after reinstalling it threw errors, thence I discovered my server was not able to execute any php file.
Additionally, when I access the file (home.php) via localhost/home.php it shows a blank page but if follow the path file:///var/www/html/home.php it brings a pop up that asks me to either save or open the script.
I think problem is the apache-php-mod is not well installed,I suggest you purge remove all apache and php package,then reinstall them.
sudo apt-get purge apache2
sudo apt-get purge php
sudo apt-get autoremove
Then,find all apache2 or php files, and remove them,you can do it by using find command,be carefully when do this!
sudo find / -name apache2
At last,you can reinstall them

Apache2, Wordpress index.php not executed, just text file

I have a problem with apache2, wordpress and php.
I configured virtual hosts and copied the existing wordpress (installed in single host).
The web server is working fine and loads the index.php, but doesn't execute it.
Check mod-enabled folder in your apache. You must have two files their php5.load and php5.conf. If not present, its means php support is not their.To enable php support use command a2enmod php5
It is because your apache2 can't execute php.
In my case, I install libapache2-mod-php by:
aptitude install libapache2-mod-php7.0
Then restart apache by:
/etc/init.d/apache2 restart
May it help you.

Apache http server dose not generate the "phpmyadmin" page

after installing the Apache http server and make sure it working.
Just added the folder of phpMyAdmin-4.2.0-english to the \Apache2\htdocs.
Renamed the folder to phpmyadmin.
while trying to view the page via http://localhost/phpmyadmin/index.php.
the page is not generated as php page.
all i can see is a textual page. (the index.php content as a text).
Did i miss anything? there is anything else i should install?
Try installing it using your package manager first. Once you get that to work, remove it and use the install you downloaded.
Assuming you're using Ubunutu/Debian:
$ sudo apt-get install apache2 php5 php5-mysql mysql-server phpmyadmin

php page being downloaded instead of being processed while accessing outside a particular domain

I have installed PHP5 with apache 2.2.16 and trying to serve an application based on php.
I am able to acess this application inside a particular domain (php scripts are processed normally) but when i trying to access it outside that domain my php pages are being downloaded instead of being processed ?
What could be the reason?
Are you sure Apache and PHP5 are properly installed? If Apache is not actually parsing the php files after you've installed PHP5 and restarted the server, install libapache2-mod-php5. This is usually installed when you initially install the PHP5 package, but perhaps it might have been moved or removed intentionally or inadvertently by other packages which need other PHP versions.
You may also need to actually enable PHP by doing sudo a2enmod php5 followed by sudo /etc/init.d/apache2 restart. If sudo a2enmod php5 returns "$ This module does not exist!", you should purge (not just remove) the libapache2-mod-php5 package and reinstall it.

Categories