How to access phpinfo.php? - php

I am trying to access
http://localhost/phpinfo.php
but I can't find a way to get there on the local machine I made the update on.
This is part of a FastCGI installation to Host PHP Applications on IIS 6.0.
I followed steps here: 'Test PHP CGI' in http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis-60
I copied phpinfo.php as indicated in the link above in the F:\Inetpub\wwwroot directory as indicated here http://msdn.microsoft.com/en-us/library/ms474356(v=office.12).ASPX
then tried to access
http://localhost/phpinfo.php
but I don't get anywhere (I get: 'The webpage cannot be found' error message).
Any help is appreciated.
Thanks,
Izumi.

You should be able to get all the information by saving a file with the following:
<?php
phpinfo();
?>
and simply view that page.
While you are testing, you can drop it anywhere you like, but obviously remove it from a production box as anyone will be able to see it.

I had to add the .php extension in the IIS Web Sites Properties as indicated here http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis-60 under 'MANUALLY CONFIGURE THE FASTCGI EXTENSION TO WORK WITH PHP'
I am not sure why the script didn't do it for me. Maybe because I had two domain names on that server.
Thanks for your help!
Izumi.

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

Viewing a PHP after uploading on Filezilla

This is my first time I use Filezilla and ftp. I uploaded my files.php. After I entered the hostname on address bar, I could see which files I had uploaded.
The interesting part comes here: When I clicked on index.php to view, It displayed only the html parts.
When I opened page source code, I saw that my php was commented, like this:
From what I had originally written:
<?php include '/includes/php/menu.php'; ?>
it became:
<!--?php include '/includes/php/menu.php'; ?-->
If anyone could help me I would appreciate it. Does any of the above has anything to do with host properties? From what I read, it supported php.
Your host may support php, but that does not mean that PHP is enabled. You can perform a very simple test to find out.
Create a file named test.php and drop one line of php in it and save it:
<?php phpinfo(); ?>
Upload the test.php file to the server and point your browser to it. It should output a bunch of information about the web server if PHP is working.
If not, check your host admin (cpanel) to see if you can enable it yourself. If you don't find it, just submit a ticket to have your host enable it.
PS: Remember to delete the test.php from your site as it is not great for security to leave it there.
UPDATE:
It sounds like you don't have Includes module installed. If you are using Apache, make sure the Apache Module mod_include. To check if you have the module installed you should create a file called phpinfo.php and upload to your server root and it should include the following code:
<?php
phpinfo();
?>
Then load phpinfo.php in your browser and mod_include should be included in the section Loaded Modules. It would be highly unusual if it wasn't there, as it is the default to have it installed on most Apache systems. If you are not on an Apache server, you can still follow the above instructions.
You can set the default editor to view/edit files under Settings->File Settings->Filetype Associations. An example using Notepad is below. There is also a box to inherit system filetype associations and I have it checked.
txt C:\Windows\System32\notepad.exe
php C:\Windows\System32\notepad.exe
I wanna thank all for your support. I am rather newbie in PHP and with you advice I have learnt a lot in the process. I have low rep so I can't give good rates to your answers.
The problem consisted in ftp, but later after changing some options in the host everything went OK. I guess working with PHP offline differs from online.
Thanks a lot everyone

Apache doesn't execute my copied PHP files, but testing.php works

I've just installed LAMP on my Ubuntu 9.10 machine, and everything works fine except when I copy my PHP files from another computer.
The LAMP guides I've followed also made me create a phpinfo() test file, which works, but when I try to type in e.g. index.php absolutely nothing happens - just a blank page in FireFox. :(
The files are in the exact same directory.
I'm thinking it's probably something with permissions and so on, but since I'm new to both PHP and Ubuntu, I'm kind of lost. It's like I can't create a PHP file with my file browser, but only by using the terminal - like when I created the testing.php from the LAMP guide.
Whaddayaknow... I made an error, tried to:
echo "Hello" world
which, even though I'm a PHP noob, I clearly know is wrong.
I think I'll have to figure out how to enable some sort of error reporting, a blank page is clearly not good enough.
You mean you have a index.php (copied from another computer) and a test.php (edited by hand, with a call to phpinfo()) in the same apache directory, the second works from your browser and the first doesnt ?
That can be a permission issue, or some compilation error in your php.
About permissions, for files should be readable from the apache server (more precisely, form the user that runs the apache server). You can type chmod a+r index.php.
YOu can also check your apache error logs (location dependent on installation). In any case it's vital to know where the error logs are if your are developing a web site.

a problem with creating a site in IIS 7.5 which is using PHP

I am trying to run web application scripted in PHP on windows server 2008. I have configured PHP (as fastcgi) and IIS. Everything goes fine except the following scenario.
In the php.ini document "doc_root" edited with the correct root path for my php projects which is "c:\inetpub\wwwroot\". I created a new site on IIS and mapped it's path to "c:\inetpub\wwwroot\application1". When I try to open this site, I see that somehow (IIS or PHP no idea ) does nt run my new application on the path "c:\inetpub\wwwroot\application1". It tries to run on "c:\inetpub\wwwroot\", which returns 404 of course. What am I missing here ?
Check to see whether you are changing and loading Correct php.ini file using phpinfo()
For those who have the same problem;
I have figured out the problem. setting "doc_root" is not right. As I commented that property in php.ini file it got ok.
Also checking the following url was helpful:
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/
Its written there that you can make your php web sites use seperate php.ini files. I found this link really usefull.
Don t want to choose my answer as the right one but have to. Hope this helps.

500 error with CodeIgniter

I have just moved my CodeIgniter project to a new server and now I'm getting a 500 error and no output from the project. It works fine on my old server and in my test environment. I'm completely stumped how to troubleshoot this, especially as there's nothing of use in the log files. Any help would be great!
Well, this is embarrassing. I was missing php-mysql. CodeIgniter wasn't logging the fact that it couldn't find it, nothing was appearing in /var/log/messages. Installed it and suddenly, it works. Thanks all for your answers.
I get this problem on my live server with SuPHP. To avoid it, all PHP files must have permissions 0644, and directories 0755.
To do this without a headache, do one of the following:
Get an FTP client that will upload using permissions you specify
Find a PHP script that will change permissions, based on filtering criteria, after upload
Get shell access to your host!
Some ideas for you:
Are you sure there is nothing in the log files? Have you checked both the web server's log files as well as the system logs (EG: /var/log/messages)? Have you checked all of the logs enabled in php.ini?
Double-check your CI configuration settings. Perhaps you are pointing to the wrong database?
Have you confirmed that a basic PHP script <?phpinfo(); ?> works? This would isolate the problem to CI
Most likely you have not specified the base url for the new location, you can set it from file:
/system/config/config.php
at line:
$config['base_url'] = 'your new url here';
have you try load a new CodeIgniter project, and try to load in ur test environment? is it work?
From my experiment 500 error normally due with web server problem. But from what your said you didn't have any .htaccess. You better try just load a clean CI project and see your webserver OK or not.

Categories