Index.php doesn't work on VPS but other files do - php

I've got really interesting problem with my VPS.
I've already installed www server using this instructions set: http://wiki.debian.org/LaMp and everything looks fine, but index.php file doesn't work.
It's main file of whole service and it's contains some initializations and includes. When I add there some echo, it display correctly. It seems that include function doesn't work.
Phpmyadmin works fine, other php files works but no index.php. I'm pretty sure it's not problem with file because it works great on old hosting.
Any ideas? I've searched the net, reinstalled everything twice but still i don't have any solution and i'm starting to feel helpless. If you need some additional information - ask.

My main guess is, that it throws an error which is not displayed.
Try adding this to the top of your PHP file:
error_reporting(E_ALL);
ini_set('display_errors', '1');
that should show you all the errors.
alternatively, you can check your error-log

Related

404 not found error on localhost .php file

I'm just starting to learn php programing and I'm having this frustrating problem that does not let me to go on.
I just set up LAMP server on my linux mint with default settings on localhost. Problem is that when I create .php file in var/www browser can not find it and shows 404 not found message.
When I created info file to view php info everything worked fine,
<?php info(); ?>
when creating new random php file in same location then the error comes up.
I lost whole day looking for an answer but not luck.
I tried to reinstall the LAMP and it gave me the same result.
Then I found a post that suggested, default location for .php files might be in /var/www/html and not /var/www, so I tried that and it worked.
Hope somebody will find this helpful.
You are using incorrect function.
<?php phpinfo(); ?>
I am working on windows, but the issue might be the same - just use a root directory which doesn't have whitespaces. ~~ hope it helps

Cant see any changes on browser when modify code YII

Hi I have got project where I have to do some changes, but then I do some changes in php files I can't see any changes in web browser, only then I deleted files, when I see error in windows, but if I comment all lines from same file, and want see changes, when I refreshed the page where will be page like before, what means I see page like normally, and if I download the file and open it I see commented lines.
So I am using YII framework, I understand that I should turn on debugging on, so in [project-name]/index.php file in the top I pasted code.
defined('YII_DEBUG') or define('YII_DEBUG',true);
But it didin't work for me, still can't see any changes.
I also try ctrl+f5 on page refresh.
Maybe I should look in to Apache configuration?
If some one know please help.
I believe that defined('YII_DEBUG') or define('YII_DEBUG',true); causes a debug dump to be sent to the screen when an exception is thrown. Without that code there will be a single line exception error.

php configure - Server error The website encountered an error while retrieving

Someone just upgraded to PHP 5.4.8 and now I get an error:
Google Chrome:
The website encountered an error while retrieving http://10.10.1.22/. It may be
down for maintenance or configured incorrectly.
Firefox:
Blank all white window
I did some playing around and found if I put just index.html in the /var/www/html, it display's it. But if I put in a fresh copy of joomla I get that error. I get the same error when trying to access phpmyadmin.
Everything was working fine before the upgrade, any idea's on what I need to configure? Suggestions one things I should look at or try.
I believe LAMP is installed.
if I put just index.html in the /var/www/html, it display's it. depicts that there is no php configuration problem.
There may be some extension specific issue. You may try with a default Joomla installation and add extensions one at a time until you identify which ones specifically have an issue and then refer to the extension developers - they may not be aware of the issues.
Html doesn t need server intervention to display.
Try to put a php file instead: index.php
Inside put these codes :
<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
echo "Hello World!";
echo "php is working";
php_info();
//this should generate an error--->
echo $unknown_var;
?>
<html>
Html is working
</html>
This should help you identify what is wrong.
My guess is that your server may need to be restarted.
EDIT
It seems you have a problem with the setting open_basedir
or a .htaccess is preventing you from acccessing your www director.
olso chek the value of doc_root

php include_once not working in cacti on archlinux box

I had cacti installed on my ArchLinux box but I don't know after upgrading my system php include_once() has stopped working and it doesn't include files any more.
However if I replace include_once() with include() things start working again, but some files get included twice which causes some other issues.
I don't know how this problem can be fixed, I've almost tried everything but can't get it to work, can someone help me fixing this problem please.
There must be a error or something, because include and include_once do the same work, one repeats one doesn't.
So first try to use include_once to include a php file in a new file (check the permissions given to files). If there is any error, post it here.
If still you're having this problem, put the content of file you want to include it using include_once here and the file that includes that file.
(P.S.: If nothing helped, consider reviewing the php configuration files, or re-installing the PHP)

PHP scripts are not executing on some of the pages

One of my php website is not working fully. Its showing me only home page and when i try to open up any present link it shows me the php code of the file that is called in for that link.
PHP is installed properly. Same server is hosting more than 10 other websites of PHP. No .htaccess parameters etc.. Same site is working on some other server with same settings and same code... I am unable to find the reason..
Make sure you are using
<?php .. ?>
tags everywhere, you might know this, but I am pointing it out just in case.
In earlier versions, apache would pick up and compile anything with
<? ... ?>
tags and it was a mistake since it was getting confused with the xml file versions.
so they changed it to complie only stuff in
<?php ... ?>
Also, again, you might know this, make sure you are hosting it on a php supported server.
There is also this "feature" that you can configure in your .htaccess to ignore certain files. make sure your .htaccess is not having exceptions for php compilation.
I cant think of anything else right now :)
Make sure everything of your PHP-Code is between the php tags like
iamserious has written upstairs.
Make sure you're filename's extension is .php index.php for example.
Make sure it's in the path to the file is ok!
Make sure you're webserver is working perfectly with PHP!

Categories