Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-17-2012, 09:28 PM   PM User | #1
hughesa1
New to the CF scene

 
Join Date: Apr 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
hughesa1 is an unknown quantity at this point
PHP Not Working on My Computer

I am working through Sitepoint's Build Your Own Database Driven Website with PHP and MYSQL. I am at chapter 3. I followed the installation instructions and installed PHP, MYSQL and APACHE individually. I did everything it asked. The problem I have is PHP does not seem to be working. When I go through the URL query string example in Chapter 3, the echo statement is not displaying anything. I checked the today.php script (which displays the time) we created earlier and the PHP is not working here either (in other words, it displays the HTML content but does not show the time). I have also uploaded a script of mine and all that is displayed is either a blank page for some pages and all the PHP stuff in plain text for other pages. This script works fine when I uploaded it to my host.

I have installed the following:

Apache HTTP Server 2.2.22 (httpd) - Win32 Binary without crypto (no mod_ssl) (MSI Installer)
MySQL 5.5.22 - Windows (x86, 64-bit), MSI Installer
PHP 5.3.10 - VC9 x86 Thread Safe

I am tempted to just install WAMP or something similar but I would much rather keep them individually installed and get to the bottom of this problem. Plus, I am not even sure how I would uninstall the individual packages.
hughesa1 is offline   Reply With Quote
Old 04-17-2012, 09:33 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 45
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
I'm totally baffled why you're here commenting about a book from sitepoint.. surely their own forums would of been the most logical place to ask for technical support with their book?

That aside, I would personally uninstall all of those that you have installed and use a wamp setup (xampp or uniformserver will do nicely) that has everything preconfigured and ready to run. Trying to get Apache, MySQL and PHP installed manually and all working together is a nightmare. Sure in theory it's just messing about with the right configuration files but in practice it's a lot more complex.

As long as you have a working setup, you should be ok for learning. They all work in the same way they would if you had done them seperately.

As for unintalling them... control panel > Add / Remove programs?
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Users who have thanked tangoforce for this post:
hughesa1 (04-17-2012)
Old 04-17-2012, 09:48 PM   PM User | #3
hughesa1
New to the CF scene

 
Join Date: Apr 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
hughesa1 is an unknown quantity at this point
Quote:
Originally Posted by tangoforce View Post
I'm totally baffled why you're here commenting about a book from sitepoint.. surely their own forums would of been the most logical place to ask for technical support with their book?

That aside, I would personally uninstall all of those that you have installed and use a wamp setup (xampp or uniformserver will do nicely) that has everything preconfigured and ready to run. Trying to get Apache, MySQL and PHP installed manually and all working together is a nightmare. Sure in theory it's just messing about with the right configuration files but in practice it's a lot more complex.

As long as you have a working setup, you should be ok for learning. They all work in the same way they would if you had done them seperately.

As for unintalling them... control panel > Add / Remove programs?
Thanks. How do uninstall PHP. Mysql and Apache are being uninstalled as we speak. PHP is not on uninstall programs list.
hughesa1 is offline   Reply With Quote
Old 04-17-2012, 10:08 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,742
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
PHP isn't an installed program. If you used an MSI it probably just created registry entries.
These versions aren't really compatible; the 2.2x version of apache is designed for use with VC6 builds of PHP, not VC9s. Since 5.3.2x+ doesn't appear to have a VC6 version, you'd either need to manually compile it, or use a different version of apache. In fact, I just installed a new version on my system as well, and was sad to discover that the new versions of missing dlls even though it specifies that the apache build is compatible with these versions.
Download these:
PHP: http://windows.php.net/downloads/rel...32-VC9-x86.zip (or choose the 5.4 version if you want)
Apache: http://www.apachelounge.com/download....4.2-win32.zip
php5apache2_4.dll: http://www.apachelounge.com/download...-5.4-win32.zip

- Extract Apache to a directory of your choice. I installed to D:\Server\Apache.
- Configure {apache}\conf\httpd.conf. Specify your workspace directory and configure the necessary directory commands
- Install the services. I like to separate my PHP installs so I can easily swap different modules. I do so by calling command httpd -D PHP_5_4_0 -n "Apache with PHP 5.4.0" -k install. This will create the service.
- Extract PHP. I placed mine in D:\Server\PHP\PHP-5.4.0
- Modify httpd.conf. Since I added a defined name, I modified as follows
Quote:
<IfDefine PHP_5_4_0>
LoadModule php5_module D:/Server/PHP/PHP-5.4.0/php5apache2_4.dll
</IfDefine>
- Save.
- Extract the dll download to the PHP install directory.
- Start services.
- Win.

MySQL is distinct, and has no relationship to apache or PHP. I can give better install details when I get home.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
hughesa1 (04-17-2012)
Old 04-17-2012, 10:13 PM   PM User | #5
hughesa1
New to the CF scene

 
Join Date: Apr 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
hughesa1 is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
PHP isn't an installed program. If you used an MSI it probably just created registry entries.
These versions aren't really compatible; the 2.2x version of apache is designed for use with VC6 builds of PHP, not VC9s. Since 5.3.2x+ doesn't appear to have a VC6 version, you'd either need to manually compile it, or use a different version of apache. In fact, I just installed a new version on my system as well, and was sad to discover that the new versions of missing dlls even though it specifies that the apache build is compatible with these versions.
Download these:
PHP: http://windows.php.net/downloads/rel...32-VC9-x86.zip (or choose the 5.4 version if you want)
Apache: http://www.apachelounge.com/download....4.2-win32.zip
php5apache2_4.dll: http://www.apachelounge.com/download...-5.4-win32.zip

- Extract Apache to a directory of your choice. I installed to D:\Server\Apache.
- Configure {apache}\conf\httpd.conf. Specify your workspace directory and configure the necessary directory commands
- Install the services. I like to separate my PHP installs so I can easily swap different modules. I do so by calling command httpd -D PHP_5_4_0 -n "Apache with PHP 5.4.0" -k install. This will create the service.
- Extract PHP. I placed mine in D:\Server\PHP\PHP-5.4.0
- Modify httpd.conf. Since I added a defined name, I modified as follows

- Save.
- Extract the dll download to the PHP install directory.
- Start services.
- Win.

MySQL is distinct, and has no relationship to apache or PHP. I can give better install details when I get home.
Hi. Thanks for the advice. Should I delete the C:\PHP folder before installing WAMP? I have decided to make things easier for myself and install WAMP . Seperating things is just a little too confusing to me. But thanks anyway.
hughesa1 is offline   Reply With Quote
Old 04-17-2012, 10:15 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,742
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by hughesa1 View Post
Hi. Thanks for the advice. Should I delete the C:\PHP folder before installing WAMP? I have decided to make things easier for myself and install WAMP . Seperating things is just a little too confusing to me. But thanks anyway.
I would. I'd spend the time cleaning up so I'd delete it.
Fou-Lu is offline   Reply With Quote
Old 04-17-2012, 11:01 PM   PM User | #7
hughesa1
New to the CF scene

 
Join Date: Apr 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
hughesa1 is an unknown quantity at this point
You'll never guess what. Installed WAMP and I have the exact same problem as before. Let me explain. I have this small script:

<p>Today&rsquo;s date (according to this web server) is
<?php
echo date('l, F dS Y.');
?>
</p>

But when I run the page today.php in my browser, all that it displays is:

Today’s date (according to this web server) is

No date.

I have also reinstalled my real estate script and once again the pages are either showing as blank or the php code is being shown as plain text. What has gone wrong?
hughesa1 is offline   Reply With Quote
Old 04-17-2012, 11:14 PM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,742
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
View the source code of the script (parsed HTML output source). Does it show the <?php ?> block? If so, its not set up to parse the php code.
To do that you modify httpd.conf and add: AddType application/x-httpd-php .php. Make sure you are attaching via http:// and not via file:// as well.
That assumes you have a .php extension as well.
Fou-Lu is offline   Reply With Quote
Old 04-18-2012, 04:09 PM   PM User | #9
hughesa1
New to the CF scene

 
Join Date: Apr 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
hughesa1 is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
View the source code of the script (parsed HTML output source). Does it show the <?php ?> block? If so, its not set up to parse the php code.
To do that you modify httpd.conf and add: AddType application/x-httpd-php .php. Make sure you are attaching via http:// and not via file:// as well.
That assumes you have a .php extension as well.
Sorted it. Thanks. I was using file:// instead of localhost. I am starting to wonder if I was using that before and that is why it was not working when I had the packages installed individually. Hmm. My property site script still ain't working though. I suspect this is because the code is PHP 4. It even uses tables for layout and other html layout aspects. I'll have to try figure this one out.
hughesa1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:51 PM.


Advertisement
Log in to turn off these ads.