Forum Moderators: coopster

Message Too Old, No Replies

Problems getting PHP to work on Apache, using WebServ

Any suggestions would be great!

         

TheZPS

3:24 am on Aug 9, 2006 (gmt 0)

10+ Year Member



OK, I'll admit that I am very new to this. There is an old thread, that is now closed, on this very topic. I have read it and tried some of the stuff described on it, not succeeded, so I am starting another thread.

I am trying to install Apache & PHP (& MySQL eventually, but I havent gotten that far) to make some dynamic web-sites. I dont know PHP or MySQL, and havent used Apache before. I cant seem to configure Apache to work with PHP.

I have tried the following

XAMP-didnt seem to do anything, so I uninstalled it

Manually installing it based on instructions on this thread and on the Apache Lounge. Ive downloaded the VC++ thing from Windows


Apache seems to work fine, I can see HTML on it and everything.

With XAMP, and manual installing when I tried viewing PHP files I would get a standard internet explorer error message. I uninstalled everthing & tried installing Webserv (another packaged installer thing, like XAMP...I guess). Now, with Webserv installed, I dont get an error message when viewing PHP files. The browser just seems to ignore the PHP. for example

I type

Hello <? echo "world" ;?>

into a .txt file and save it as a .php file in the document root. All I see in the browser is

Hello

Not sure why it is just ignoring the PHP code. Perhaps someone who knows how Webserv is set up can explain.

Any insight or advise would be helpful. Like I said, I am very new to this. Thanks

P.S. Also, I have uninstalled & installed Apache, PHP & MySQL several times, and may have to do so again. If I just uninstall it might bits of the program remain that would interfere with it if I download it again? How can I be sure that I have gotten rid of it so I can re-install it?

wsmeyer

5:04 am on Aug 9, 2006 (gmt 0)

10+ Year Member



I have a hunch you are using Windows XP Home?

If so, you're not alone, I had setup Apache/MySql quite a few times but the one computer I have on Home edition was my downfall. I tried every step-by-step tutorial on the web and could never get it to work. I finally tried an older version of XAMP and had it working first try. If that's you're situation let me know and I'll try and trace back what I did.

William.

dreamcatcher

7:48 am on Aug 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For this to work:

<? echo "world" ;?>

You need to enable short tags in your PHP.ini file. Alternatively, always use:

<?php echo "world" ;?>

dc

coopster

2:53 pm on Aug 21, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I agree. Save yourself some headaches, and others as well, especially if you are going to distribute any code.


Note: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.

Resource:
Basic syntax [php.net]