473,507 Members | 6,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php not working with 'localhost'

When I run a php file in my browser using an IP address, it renders
just fine. But when I run the php file using 'localhost', it renders
the source code. It's as if it does not recognize it as php. There are
other variables, but I don't want to make a full page post.

In a nutshell:
(http://192.130.0.230/~username/file.php) works
(http://localhost/~username/file.php) does not work.

oh.. I'm using a MAMP setup

~mike (new to this group)

Jul 2 '07 #1
2 9647
Sounds like an apache configuration issue. The following is an excerpt
from the INSTALL file that comes with the php distribution:

----
14. Edit your httpd.conf to load the PHP module. The path on the
right hand
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have
already
added this for you, but be sure to check.

For PHP 4:

LoadModule php4_module modules/libphp4.so

For PHP 5:

LoadModule php5_module modules/libphp5.so

15. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.

AddType application/x-httpd-php .php .phtml

It's also common to setup the .phps extension to show highlighted
PHP
source, this can be done with:

AddType application/x-httpd-php-source .phps
----

Make sure that you have done this in your apache configuration file
such that apache knows that any requests for localhost handle .php
files with the php module.

That is not particularly helpful, but I hope it at least points you in
the right direction

On Jul 2, 10:49 am, MikeDub <mworthi...@gmail.comwrote:
When I run a php file in my browser using an IP address, it renders
just fine. But when I run the php file using 'localhost', it renders
the source code. It's as if it does not recognize it as php. There are
other variables, but I don't want to make a full page post.

In a nutshell:
(http://192.130.0.230/~username/file.php) works
(http://localhost/~username/file.php) does not work.

oh.. I'm using a MAMP setup

~mike (new to this group)

Jul 2 '07 #2
MikeDub wrote:
When I run a php file in my browser using an IP address, it renders
just fine. But when I run the php file using 'localhost', it renders
the source code. It's as if it does not recognize it as php. There are
other variables, but I don't want to make a full page post.

In a nutshell:
(http://192.130.0.230/~username/file.php) works
(http://localhost/~username/file.php) does not work.

oh.. I'm using a MAMP setup

~mike (new to this group)
I agree this looks like an Apache configuration problem. Try
alt.apache.configuration.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2481
by: vishal | last post by:
i have created one page in asp login.php on my pc it is working as http://localhost/index.php but when i access this page from other computer in network it is not working pls help me ...
0
1670
by: Matthew Ferri | last post by:
Hi, Summary: I'm a newbie to FrontPage and IIS. I have a simple issue that I believe may be a configuration setting somewhere. If there is a KB article, I just cannot find it.
7
5835
by: 7 | last post by:
I installed postgres and phppgadmin debian unstable (on ProMepis RC4) but I can't seem to access it. I type http://localhost/phppgadmin and it says file not found. Look in /var/www and sure...
6
1945
by: Chakkaradeep | last post by:
hi all, I have written a C# Service which is a Server accepting Clients,It is working fine when i connect from localhost but when i connect from any other machine to my machine , the service is...
5
3563
by: Jeff Johnson | last post by:
I'm using forms authentication to protect a subfolder within my site. I've got it working fine except for two issues: (1) When I do a RedirectFromLogin page I have to put a cookie path ("/"...
11
1846
by: tshad | last post by:
I have a W2003 server running my website and I am trying to set up my pages to send email using System.Web.Mail. I have pages running on this machine using CDONTS that work fine. I am using...
3
13943
by: RobertS | last post by:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to work when referencing WebResources.axd. For example, I have an aspx script that works fine when run from Visual Web...
4
2255
by: lumazi | last post by:
Hello Everyone, I have a confusing problem. I'm getting the following error message on an ASPX page ... Session state can only be used when enableSessionState is set to true, either in a...
7
5289
by: Martijn | last post by:
Hi all, I installed following pkg. on my laptop (Fedora Core 6) : db2exc_91_LNX_x86.tar.gz After resolving some dependency-problems the install was fine. (I understand that a laptop isn't...
1
2535
by: nubian | last post by:
i'm a noob using gentoo and today i emerged apache with apache2 in my USE variable in /etc/make.conf, started the server and tested it from a browser using: http://localhost/ .So far so good. Then i...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.