Results 1 to 9 of 9

Thread: PHP + Apache web server

  1. #1
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Question PHP + Apache web server

    hello!

    I have created a "test.php" file in "/var/www/html " and in /etc/httpd/conf.d
    i have the file php.conf containing:

    Code:
    #
    # PHP is an HTML-embedded scripting language which attempts to make it
    # easy for developers to write dynamically generated webpages.
    #
    
    LoadModule php4_module modules/libphp4.so
    
    #
    # Cause the PHP interpreter to handle files with a .php extension.
    #
    AddType application/x-httpd-php .php
    
    #
    # Add index.php to the list of files that will be served as directory
    # indexes.
    #
    DirectoryIndex index.php
    Now, when i try to access the file by writing in browser:

    192.168.0.102/test.php

    a blank page is displayed.I have tried two scripts :

    Code:
    <?php phpinfo(); ?>
    and

    Code:
    <?php echo"Hello world"; ?>
    but everytime i restart the httpd, and try to access the page.The page displayed is blank.Can anyone help me with this problem?

  2. #2
    take a look at the source of the page. If there is <?php phpinfo(); ?> then the page is being displayed but, not rendered by PHP. take a look at the httpd logs. those usually tell you something.

  3. #3
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Question Can't figure it out!

    Hello!

    I have tried different solutions from net.But any of them didn't worked.Can anyone suggest me something?

  4. #4
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Quote Originally Posted by honey bee
    Now, when i try to access the file by writing in browser:

    192.168.0.102/test.php

    a blank page is displayed.I have tried two scripts :

    Code:
    <?php phpinfo(); ?>
    and

    Code:
    <?php echo"Hello world"; ?>
    but everytime i restart the httpd, and try to access the page.The page displayed is blank.Can anyone help me with this problem?
    Try this as index.php .
    Code:
    <html>
    <?php echo"Hello world"; ?>
    </html>
    You need to put php codes in html tags since php is just scripting and not displaying codes. You need to tell your browser to how to display it. The php part was just so that your server knows it needs to script it.

    HTH ..
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  5. #5
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Oh yeah, you need to do the same thing for phpinfo() function call. I just tested it and it worked.
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  6. #6
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Thanks a loT!

    Hello!

    Thanks a lot for your reply, but it isn't working also.

  7. #7
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Where is your php installed? Check like this

    Code:
    whereis php
    Mine return as /usr/bin/php

    Then I do

    Code:
    /usr/bin/php -v
    which return

    compunuts@sienna64:~$ /usr/bin/php -v
    PHP 5.0.5-2ubuntu1.2 (cli) (built: Mar 8 2006 08:18:28)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies
    compunuts@sienna64:~$
    If you want to see if it's working on my site, check here.

    The code is

    Code:
    <html>
    <head>
    <title> System Information - Sienna64 </title>
    </head>
    <?php phpinfo(); ?>
    </html>
    ~
    "index.php" [readonly] 6L, 97C
    HTH ..
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  8. #8
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Also, what's your apache version?

    Code:
    apache2 -v
    Mine return

    Code:
    compunuts@sienna64:/etc/apache2/mods-enabled$ apache2 -v
    Server version: Apache/2.0.54
    Server built:   Jan  7 2006 13:51:23
    compunuts@sienna64:/etc/apache2/mods-enabled$
    Make sure you have the php modules loaded.

    Code:
    compunuts@sienna64:/etc/apache2/mods-enabled$ ls
    php5.conf  php5.load
    compunuts@sienna64:/etc/apache2/mods-enabled$
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  9. #9
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Smile

    Hello!

    Sorry for replying late.My system crashed and i did re-installation.Now, php is working fine.Thanks a lot for your concern.

Similar Threads

  1. Active Directory LDAP Compliance
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 03:34 AM
  2. Set Up SQL Server with Proxy Server
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 03:18 AM
  3. ISA Server on Server 2003
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 09:50 PM
  4. ISA Server on Windows Server 2003
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 09:49 PM
  5. Live Communications Server 2005 Glossary
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 09:16 PM

Bookmarks

Posting Permissions

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