Find the answer to your Linux question:
Results 1 to 6 of 6
Hi: I have a new problem now. I have installed Redhat 9.0 and Apache, PHP and MySQL are packages that came with RH9. I was able to initialise and start ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2003
    Posts
    6

    How to Run PHP Scripts


    Hi:

    I have a new problem now. I have installed Redhat 9.0 and Apache, PHP and MySQL are packages that came with RH9. I was able to initialise and start Apache and MySql. But coming to PHP, i dont know how to initialize it. From some of my friends i came to know that Apache+LINUX have the feature of automatically executing PHP scripts too. But when i created a basic HTML file "Hello World" and tried to open it..it shows me the entire HTML code..i dont know where to save the PHP and HTML files that i create and how can i view my HTML File.I tried saving the HTML file in var/www/HTML/mrtg folder and open my file. all the files in the folder open up except for my file. Please help me in this so that i can go ahead and start my web application. There are no syntax errors in my file thats for sure...the code in my file goes like this
    <html>
    <head>
    <title>check</title>
    </head>
    <body>
    Checking the file
    </body>
    </html>

    Do i need to edit the httpd.conf file to initialise it to run PHP. if yes how can i go about doing that.

  2. #2
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416
    I think your post is a bit unclear.

    I assume you have not modified httpd.conf and that the service is running?
    By default the Apache server is using /var/www/html as default diectory.
    If you open a browser and type http://localhost than you should see a page appearing. It has some textsaying that your server is up and running.

    Place a file in this directory and named it, for example, test.php

    Insert the following in the file
    Code:
    <? phpinfo&#40;&#41;; ?>
    now run http://localhost/test.php and if php is running you should see a page with a lot of details on your apache/php setup

    try this first. I am not sure if you have to enable php in httpd.conf when you install it from the packages.

    I added the following manually om my freebsd box


    LoadModule php4_module modules/libphp4.so
    AddType application/x-httpd-php .php

    Cheers

  3. #3
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    You need to uncomment the php-module in /etc/httpd/conf/httpd.conf and the just put a index.php file in your wepagedirectory... try to create and index with this text in...

    Code:
    <?php
    
    echo "Hello World....do you see this text??";
    
    ?>
    Regards
    Regards

    Andutt

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User
    Join Date
    May 2003
    Location
    Hong Kong, China
    Posts
    256
    there is a very detailed guide in the official php website, www.php.net

    I am working on it as well. LOL
    Signature removed by moderator - please see forum rules

  6. #5
    Just Joined!
    Join Date
    Jun 2003
    Posts
    6
    Thanks everyone. I am able to run my php pages now. I had to edit the httpd.conf file and add in the loadModule and addApplicationType and it worked. Thanks again. This forum is a lot more helpful to me.

  7. #6
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    Good...thats why we are here...to help people.

    Regards
    Regards

    Andutt

Posting Permissions

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