473,569 Members | 2,522 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 9650
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...@gma il.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.conf iguration.

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

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

Similar topics

9
2484
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 thxs for your reply in adavance...............
0
1676
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
5842
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 enough, its not there and neither are any files relating to the phppgadmin. How do I get this thing to work?
6
1953
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 not working, the Service is in "Network Service".....i even tried "Local System" and also "Local Service" but the end result is , it is working only...
5
3575
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 ("/" works, or "/mysubdir") or else the auth cookie doesn't get set. I'd like to know why this is necessary. (2) When I call SignOut() the auth cookie is...
11
1851
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 our exchange server to send the mail but am getting an "Unable to relay" message. But the "From" name is my email address, which is obviously on our...
3
13945
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 Developer 2005 (Express Edition) built-in web server, but fails when run under IIS (same file, same location). I think I've tracked the problem to...
4
2257
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 configuration file or in the Page directive I've seen it before and figured something was shut off. I checked and by default the session state is...
7
5296
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 very well suited for DB2 but .... I just want to play around :-) ) After the install I started the control center. This also went
1
2539
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 emerged dev-lang/php and the apache config file got updated to include: APACHE_OPTS="-D DEFAULT_HOST -D PHP5. I then created a sample .php file in...
0
7701
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.