473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

PHP and Apache...strange things are happening...

Hi! I'm trying to setup up a web page that will eventually be hosted
but I want to develop it locally. It will use PHP to hit a MySQL
database. So I have a local database created. I installed PHP and
Apache. Next I thought I would do some basic PHP tests as I don't know
anything about PHP or Apache. So here is where my snag is.

1) I can execute at the command line:
who@where:/var/www/htdocs$ php -r 'echo "hiya\n";'
hiya

so this seems to work and makes me think PHP is a ok.

2) If I have /var/www/htdocs/my_web/test.php as following:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
what
<?php echo('hiya\n'); ?>
</body>
</html>

an open test.php in firefox I get nothing at all

3) If I have /var/www/htdocs/my_web/test.php as following:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
what
<?php echo('<p>hiya\n</p>'); ?>
</body>
</html>

an open test.php in firefox I get:

hiya\n

'); ?>

So forget logging into my database just yet! What am I doing wrong? It
seems PHP is not being processed correctly via Apache but based on the
PHP command line I think the problem is in Apache? Perhaps a missed
configuration? I've been trying to use the tutorial here:

http://us3.php.net/manual/en/tutorial.firstpage.php

to get a grasp but I'm in a holding pattern until I can get these
simple examples to work! In addition, I'm currently running my MySQL
database from /var/lib/mysql/my_db...when I go to host this will it be
stored in my main web directory? If so, can I make this db run from
/var/www/htdocs/my_web to simulate this in my local development?

Thanks!

Jul 17 '05 #1
3 1373

ri**********@revco.spx.com wrote:
Hi! I'm trying to setup up a web page that will eventually be hosted
but I want to develop it locally. It will use PHP to hit a MySQL
database. So I have a local database created. I installed PHP and
Apache. Next I thought I would do some basic PHP tests as I don't know anything about PHP or Apache. So here is where my snag is.

1) I can execute at the command line:
who@where:/var/www/htdocs$ php -r 'echo "hiya\n";'
hiya

so this seems to work and makes me think PHP is a ok.
All that means is that the command line version of PHP is working, not
that it is interfaced with Apache correctly.

2) If I have /var/www/htdocs/my_web/test.php as following:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
what
<?php echo('hiya\n'); ?>
</body>
</html>

an open test.php in firefox I get nothing at all

How are you entering the URL into firefox? If you are using the Open
under the file menu that won't work. Enter the URL
'http://localhost/my_web/test.php' which should pull up your page.
3) If I have /var/www/htdocs/my_web/test.php as following:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
what
<?php echo('<p>hiya\n</p>'); ?>
</body>
</html>

an open test.php in firefox I get:

hiya\n

'); ?>


Same comment as above.

Your first test should be to create a file, named info.php with the
following lines in it:
<?
phpinfo();
?>

And then reference it via the URL <http://localhost/my_web/info.php>

If that works, you're set to go.

Ken

Jul 17 '05 #2
Hmmm. I tried using http://localhost.my_web.test.php with no luck...

Here is more detail of my problem:
http://www.linuxquestions.org/questi...39#post1532539

I think my php.ini configuration is not quite right but I've tried both
php.ini-recommended and php.ini-dist. Magic quotes may be my issue but
the two ini files both activate and deactivate magic quotes and my
results are the same!

Thanks

Jul 17 '05 #3
Well for a start as far as I know your address should be
http://localhost/my_web.test.php (don't forget the forward slash)
I would also us names like my_web_test.php instead of "my web.test.php" as
this might bring problems down the track.
Brent Palmer.


<ri**********@revco.spx.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hmmm. I tried using http://localhost.my_web.test.php with no luck...

Here is more detail of my problem:
http://www.linuxquestions.org/questi...39#post1532539

I think my php.ini configuration is not quite right but I've tried both
php.ini-recommended and php.ini-dist. Magic quotes may be my issue but
the two ini files both activate and deactivate magic quotes and my
results are the same!

Thanks

Jul 17 '05 #4

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

Similar topics

2
by: Tobias Hesselmann | last post by:
Hi folks, i have a problem using a PHP script as a custom handler in Apache. What i wanna do is this: Whenever a .html file is requested by a browser, i want Apache to call a CGI that outputs...
4
by: ahevans | last post by:
hi, i have apache 2 and php 5 setup and in my php.ini i have set my extension_dir = "C:\WINDOWS\system32" and enabled php_mysql.dll but everytime i start apache i get a message saying that it cant...
4
by: William Sullivan | last post by:
I have an extremely weird problem that I have no idea how to approach. I have a simple page with a search textbox and a search button. The button causes a postback, where I perform the search and...
19
by: Alex Madon | last post by:
Hello, I am testing a web application (using the DBX PHP function to call a Postgresql backend). I have 375Mb RAM on my test home box. I ran ab (apache benchmark) to test the behaviour of the...
3
by: Sidu | last post by:
Ok well i'm still very new to apache, mysql, and php.. let me explain everything i have set up.. I have installed Appserv, for those of you who are unfamiliar with it.. it installs mysql, php,...
3
by: John Murtari | last post by:
Folks, Trying to build php 4.4.6 and apache 1.3.37 on RHEL 4. Each of them builds and installs okay, but when we start apache we get: Syntax error on line 238 of...
5
by: john | last post by:
All: Very experienced developer, newbie to PHP. My situation: I have installed on my WIndows XP machine the following: * PHP 5.2.1 * MySQL 5.0 * Apache 2.2 All of these are installed...
3
by: Daniel Loose | last post by:
hello, try to install php 5.2 on apache 1.3 on winxp. apache is fine. php says on start "unable to load dynamic library '<path>' " -- but <path> *does* exist! extension_dir...
5
by: Guillermo Antonio Amaral Bastidas | last post by:
Hi everybody, I have a quick and probably dumb question, keep in mind I just dumped my old love FastCGI + Perl for it's younger hotter friend PHP5. If the user calls a time consuming script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...

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.