Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,476
    Thanks
    63
    Thanked 538 Times in 525 Posts
    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?
    I can't really think of anything to write here now...

  • Users who have thanked tangoforce for this post:

    hughesa1 (04-17-2012)

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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
    <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.

  • Users who have thanked Fou-Lu for this post:

    hughesa1 (04-17-2012)

  • #5
    New Coder
    Join Date
    Apr 2012
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

  • #7
    New Coder
    Join Date
    Apr 2012
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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?

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

  • #9
    New Coder
    Join Date
    Apr 2012
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •