473,698 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP and Apache...strang e 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 1385

ri**********@re vco.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**********@r evco.spx.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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
3220
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 a header, then the requested file and then a footer. I want to use PHP for this, as i also want to do some template parsing. Well, basically, this can be done using Apache's mod_action module,
4
1658
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 find the file even though I have copied it to system32. anybody have any ideas?
4
1428
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 display the results in a DIV that has a tree. I've tested all the code up until I add in the code for adjusting the tree in the DIV and it all works fine without problems. I can perform the search and put the results in the body of the page and...
19
5245
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 application under heavy load. When increasing the number of requests, all my memory is filled, and the Linux server begins to cache and remains frozen. ab -n 100 -c 10 http://localsite/testscript
3
12145
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, and apache all in 1 setup.. Ok.. from here.. I have a folder in my local drive appserv within it.. php, apache, mysql, and www. www holds everything in my index which is what i am directed to when i go to http://localhost Everything seems to be...
3
4130
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 /usr/local/etc/httpd/conf/httpd.conf: API module structure `php4_module' in file /usr/local/etc/httpd/libexec/libphp4.so is garbled - perhaps this is not an Apache module DSO?
5
5215
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 under C:\Program Files under their own
3
1536
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 ="C:\Programme\PHP\ext" and <pathis e.g. 'C:\Programme\PHP\ext\php_exif.dll'. which *does* exist. this appears with about 20 files. reboot, reinstall, nothing
5
2857
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 and then stops or refreshes the browser before the script had time to finish will Apache kill the script mid execution or will it let it finish ? I ask this stupid question because this seems to be happening in one
0
8600
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9021
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7712
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4361
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.