logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: PHP won't show up in my browser.
Author
valiantheart



Joined: 02 Jul 2008
Posts: 8

PostPosted: Thu 10 Jul '08 0:31    Post subject: PHP won't show up in my browser. Reply with quote

I think i confiqured the files right, as apache shows PHP is loaded, but i am still having trouble. when i create a file "test.php" and input

Code:
<?php phpinfo(); ?>


or other bits of code it displays nothing in my browser. I just get a blank page.

I'm really at the end of my rope here and i feel like putting my mouse through my monitor right now. Sad

Can someone please help me? I've tried so many friggin instructions and nothing works. I'm using the latest versions of both Apache and PHP on XP.

Update-
I made some progress. I can't get php to work if the file name ends with .php.

I tried to check things out a bit more and created a file "phpinfo.html" with Notepad. I added
Code:
<html>
<?php phpinfo(); ?>
</html>


to it and then i was able to at least get the info screen. I can't help but feel that something is still wrong. Shouldn't i be able to get it with just the
Code:
<?php phpinfo(); ?>
code in a .php file?
Back to top
adonat



Joined: 03 Jun 2008
Posts: 18

PostPosted: Thu 10 Jul '08 2:38    Post subject: Reply with quote

I will try to give this a shot, although I am far from an expert on any of this. I have put together a package that runs completely out of folders. No Windows registry or system path information is added. I still have to make a PHP or Perl script to change all the paths in my configuration and batch files though.

Exclamation For simplicity, I have excluded eAccelerator, FileZilla FTP Server, Mercury Mail and PERL support. My personal information has also been stripped out of a couple files.

This is my file structure. Download and place programs in these directories. Shocked

C:\Server
Idea Directory holds misc. batch files to install, start or stop services. (Plus much more.)
Arrow My Server Batch Files - Direct link to main download page. Hope this link lasts. Confused

C:\Server\tmp
Idea Temporary directory for Apache, MySQL and PHP.

C:\Server\Apache
Idea Root directory for 'Apache 2.2.9a'. IPV6 builds of Apache have caused headaches for me.
Arrow Apache 2.2.9a - Direct link to main download page. Please use mirror.
Arrow Microsoft Visual C++ 2008 Redistributable Package (x86) - WARNING: 'Apache 2.2.9a' requires these libraries to function!

C:\Server\htdocs
Idea Web document root. Files such as 'index.php' and 'index.html' go here. WARNING: Apache seems to be case sensitive!

C:\Server\MySQL
Idea Root directory for 'MySQL 5.0.51b'. 'MySQL 5.1.25' did not work for me.
Arrow MySQL 5.0.51b - Direct link to main download page. Download 'Without installer (unzip in C:\)' version.

C:\Server\PHP
Idea Root directory for 'PHP 5.2.6'.
Arrow PHP 5.2.6 - Direct link to main download page. Download 'PHP 5.2.6 zip package [9,516Kb] - 3 May 2008' version.

C:\Server\phpMyAdmin
Idea Root directory for 'phpMyAdmin 2.11.7.1'.
Arrow phpMyAdmin 2.11.7.1 - Direct link to main download page. Download 'english.zip' from phpMyAdmin 2.11.7.1 section.

After creating the directory structure above and copying the programs to their proper directories, download the file below. Unzip this file and copy the '.\Server' directory on top of the 'C:\Server' directory. When prompted to overwrite, make sure you click 'yes to all'. This will copy my edited configuration files to their proper directories. If you are interested in the changes that I made from the originals, open and scroll through the HTML files in the 'Differences from Originals' folder. The changes will be highlighted.

Arrow My Server Configuration Files - Direct link to main download page. Hope this link lasts. Confused

After following the instructions above, run these batch files in this order.

Exclamation Apache (Manage Admins).bat - This creates the user name and password to gain access to http://localhost/phpmyadmin which won't work quite yet. Very Happy

Exclamation Apache (Manage Users).bat - This is optional as it creates a user name and password similar to the previous batch file but is not used by me yet.

Exclamation MySQL (Install Service).bat - Run only once. This will setup MySQL to run when your computer boots up.

Exclamation Apache (Install Service).bat - Run only once. This will setup Apache to run when your computer boots up.

You should now be able to access the links below.
http://localhost
http://localhost/phpmyadmin

Exclamation If these links do not work, check to make sure you have followed these instructions properly and if so, make sure you don't have another Apache or MySQL service from another installation running. Also check to be sure there is not a 'php.ini' file in the 'C:\Windows' directory from a previous installation of PHP. For some reason, PHP is hard coded to look here first and as a result, will not use my 'php.ini' file in the 'C:\Server\PHP' directory.

Side Notes:

To edit any of these files, I use Notepad++. It does some syntax highlighting and has some other neat features.

Arrow Notepad++ - Direct link to main download page.

Arrow npp.5.0.1.bin.zip - Direct link to file download. (Runs out of folder.)

Arrow npp.5.0.1.Installer.exe - Direct link to file download. (Installs program.)


Last edited by adonat on Wed 16 Jul '08 21:05; edited 5 times in total
Back to top
adonat



Joined: 03 Jun 2008
Posts: 18

PostPosted: Thu 10 Jul '08 6:40    Post subject: Reply with quote

Oh yeah and the short answer to the last part of your post is that you need to edit 'httpd.conf' in the '.\Apache\conf' directory. Look for the line that says...

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

...and change it to...

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

Apache will look for those files in that order when you don't specifically type in 'index.php', such as 'http://localhost/index.php' When you type in 'http://localhost' without specifying a file it reads the files specified in 'DirectoryIndex'.

OK I need to rest my brain now. Hope this helps.
Back to top
valiantheart



Joined: 02 Jul 2008
Posts: 8

PostPosted: Thu 10 Jul '08 10:22    Post subject: thanks Reply with quote

adonat,

I was very frustrated sometime before you posted. I ended up going to bed and when i got back up I saw your post. Before I tried your config. I decided to take another shot at trying to get it up and running myself. I know that quitting won't get me anywhere.

I fully uninstalled Apache and PHP and i tried to get rid of everything from them that may have been left over. Then I reinstalled them from the Apache.msi file and the PHP.zip.

At this point I had installed the Notepad++ that you had suggested and I was using that to edit the httpd and php.ini files. I have done that so many times over the past week that I knew exactly what to do by heart Neutral Then I created 2 files, "test.php" and "test.html" and used the
Code:
<?php phpinfo() ?>
in them both. Then only diff between them was that the .html one was embedded in html tags, which was the only way I was able to make it work earlier. (i figure that may have been to the file not being read properly? I was just using Notepad to create them so it kept comming up as "test.php.txt" and wouldn't work as php.)

Thanks for your help and the time you spent on helping out and ESPECIALLY for the link to Notepad++. You ended up helping me out alot and answering one of the big questions that I hadn't asked yet (creating a file so its .php and not .txt). I can't believe I ever did without it. I have done alot of html and in a few minutes i could easily see how much this program is perfect for my needs.

Thanks again for everything you have done.
Very Happy

I even seem to have MySQL running now, so I am very happy and now I can move on. No more road block
Back to top
adonat



Joined: 03 Jun 2008
Posts: 18

PostPosted: Thu 10 Jul '08 15:50    Post subject: Reply with quote

No problem, I have been working on this stuff in some of my free time for about two months now. I have always been meaning to document some of what I did.

My configurations are by no means fully tweaked out, but they are a good starting point. (Joomla! works for me at least.) I included the differences in HTML files so people could see what I changed and hopefully be able to modify things on there own to suit their needs. (Used WinMerge BTW)

One thing I did notice in the 'php.ini' file is that the extensions are alphabetical and may not be in the proper load order by default because some seem to have dependencies on others.

Also I commented out the SSL include towards the bottom of 'httpd.conf', although that should work if a self signed certificate is created with my batch file.

And one more 'also'. If you add a password for the MySQL 'root' account (highly recommended), you will have to edit 'config.inc.php' in the phpMyAdmin folder and edit the '$cfg['Servers'][$i]['password'] = '';' line to reflect the password change.
It is actually better to create a new superuser account and get rid of the 'root' account so if someone tries to hack your MySQL server, they will have to guess your user name and password instead of just the password. In this case, you will also need to edit the '$cfg['Servers'][$i]['user'] = 'root';' line.

Right now, I am working on a Mercury Mail problem I am having. I am sure once I figure out what is going on, it will seem obvious why it wasn't working. I can relate to the frustration you were having earlier. Hopefully by the time I am done, I will have a fully functional and secure 'lean and mean' web server.

Regards,
Aaron
Back to top
valiantheart



Joined: 02 Jul 2008
Posts: 8

PostPosted: Thu 10 Jul '08 21:53    Post subject: Reply with quote

adonat,

I'm just glad that I finally got everything up and running. I have been working on getting Apache/PHP/MySQl running for over a week and the problems I had with Apache were very frustrating. I couldn't get it running and I kept getting those "[crit] (OS 10022)An invalid argument was supplied. : Child 2132: setup_inherited_listeners(), WSASocket failed to open the inherited socket. " errors. It took me a few days to figure out that it was a firewall problem and so I scrapped my firewall.

Then it was on to PHP... That took me even longer to figure out. Looking back on it I figure my biggest problem was I tried both the unzip and installer, even trying the method that several people suggested about putting the .dll's in the system folder. It was when I went back and deleted those and uninstalled everything and then re-did it that I was able to make it all work. Through-out all the how-to's I tried I figured i got a pretty good idea of just how to config the apache and php files so i just put what I learned to good use.

Once I got PHP running fully I installed MySQL. That wasn't so hard and it shows up fine so far. I had alittle trouble just now but I think I got it figured out.

So far so good, but I still have along way to go.

My goal here is that I want to create my own online game using PHP. I kinda got tired of just playing games. I want to actually create one. I know it is alot of work and all but I used to manage a game for someone else and did up story and what not, so I know what I am in for. If you know anything that might be of use to me please let me know. I would really appreciate the input. Is there any other useful programs like MySQL admin or Notepad++?
Back to top
adonat



Joined: 03 Jun 2008
Posts: 18

PostPosted: Fri 11 Jul '08 18:09    Post subject: Reply with quote

If you are looking to speed up your PHP parsing some, eAccelerator can help a bit. I didn't have too much of a problem making it work. In hindsite, I could of left it in my config files and it probably would of been ok but I didn't want to put something in to the mix that someone may not want.

To help me get all of my programs working, what I would do (besides for a lot of reading) I would get program packages such as XAMPP 1.6.6.a and use a program called WinMerge to compare their files to the originals to see what they changed. It was invaluable in helping me along with what I needed to change, although I ended up doing a lot more.

Do not know if thats what you really were looking for or wanted but that is all I can think of at the moment. Good luck with your game programming. Here is a link to WinMerge if you feel like checking it out. It can compare whole directories too. It seems like a pretty intuitive program and is well laid out. That is what I used to make the folder patch from the originals to what I had changed. It can make simple patches like that automatically, so you only really have to back up changes instead of whole directories.

http://winmerge.org/
http://downloads.sourceforge.net/winmerge/Runtimes-2.8.4.zip <-- Direct download link for optional runtimes if you use WinMergeu.exe

Oh yeah, it can run out of a folder too. Smile If you run the unicode version though (Winmergu.exe) and you use the folder version, you need to drop a couple DLL files from a download that they offer from their site into the folder. They can't put it into their distro because of licensing or something like that (I think). It has a shell extension too so you can highlight files and compare them without having to go through the program's open commands for both files or directories.
Back to top
valiantheart



Joined: 02 Jul 2008
Posts: 8

PostPosted: Sun 13 Jul '08 19:09    Post subject: Reply with quote

winmerge sounds like a very useful program. I may just have to check it out.

Unfortunately I can't really do much of anything right now. A few years ago I hurt my back pretty badly which made alot of things dificult for awhile. Occasionaly I still have problems with my back, which has been the case for the last few days. I haven't been able to sit at my computer at all for the last few days which means that learning PHP is going to have to wait until I can sit here for more than a few minutes at a time. That is just my luck lol. As soon as I start to make some progress something happens to slow me down. In a way it's ok cause I have been reading a PHP and MySQL for dummies book right now and I know I still need to do a lot of planning regarding databases and the overall flow of my game.

One piece of good news that is that a friend of mine bought a new laptop and is selling me his old one for $100. Price-wise it's worth it. Going alittle deeper than that I actually see that it could really help me out when it comes to days like today when I can't manage to sit in my chair for too long. Also it could really help me out when it comes to play testing my game and things like that. Oh and i can't forget about those times when my girl is over and checking her email lol. Laughing She hogs my PC for hours!
Back to top


Reply to topic   Topic: PHP won't show up in my browser. View previous topic :: View next topic
Post new topic   Forum Index -> Other Software