Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Running PHP scripts

  1. #1
    Join Date
    Apr 2005
    Location
    London
    Beans
    170
    Distro
    Ubuntu 6.06

    Running PHP scripts

    I have been following a very simle PHP tutorial for beginners (hello world level). I soon learnt that in order to run the scripts in the tutorial I hade to have apache installed and and run the scripts from /var/www through a browser. That sounds straght forward, but All I see on the browser (firefox) is the contents of my script.

    I followed the Apache MySQL PHP howto on the ubuntu wiki but I eneded up with no internet conection. Not sure what I did wrong but I'm determind to get it right.

    Any help or advice would be much appreciated

  2. #2
    Join Date
    Jan 2006
    Beans
    616
    Distro
    Ubuntu Development Release

    Re: Running PHP scripts

    I just installed everything from synaptic(apache, php, mysql) and it worked right away...
    ...

  3. #3
    Join Date
    Apr 2005
    Location
    London
    Beans
    170
    Distro
    Ubuntu 6.06

    Re: Running PHP scripts

    hmm, that's what I did (three times )

    i installed PHP 5, MySQL 5, apache 2, php-mysql, php-msqli and then some.

  4. #4
    Join Date
    Mar 2005
    Location
    Ålsgårde, Denmark
    Beans
    939
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Running PHP scripts

    Run them from the path localhost/ not /var/www, otherwise they'll be served by the file-system, not Apache.

  5. #5
    Join Date
    Apr 2005
    Location
    London
    Beans
    170
    Distro
    Ubuntu 6.06

    Re: Running PHP scripts

    Quote Originally Posted by mostwanted
    Run them from the path localhost/ not /var/www, otherwise they'll be served by the file-system, not Apache.
    I was. I saved them in /var/www and then entered localhost into a browser.

  6. #6
    Join Date
    Apr 2005
    Beans
    268

    Re: Running PHP scripts

    Check that in /etc/apache2/apache2.conf you have these two lines

    Addtype application/x-httpd-php .php .phtml .phtml .html
    Addtype application/x-httpd-php-source .phps

    If they are there, they must be uncommented.

    You need to restart apache for them to take effect if you have added them.

  7. #7
    Join Date
    Nov 2005
    Beans
    2,322
    Distro
    Ubuntu Intrepid Ibex (testing)

    Re: Running PHP scripts

    install userdir extension for Apache httpd, and develop files locally, so you won't
    get unneccessary permission related trouble.

    Code:
    sudo a2enmod userdir
    mkdir ~/public_html
    copy your stuff to ~/public_html and access it using
    http://localhost/~yourusername/

  8. #8
    Join Date
    Aug 2005
    Beans
    169

    Re: Running PHP scripts

    did you install libapache2-mod-php5

  9. #9
    Join Date
    Feb 2008
    Beans
    1

    Re: Running PHP scripts

    I'm having the same problem, after using the Apache MySQL PHP howto on the ubuntu wiki i tried to run a php file i made: http://localhost/phpfile.php, but it gave me the script instead of the output, i've also tried everything in this post.

    i'm running 7.10, and i don't know if this helps but when i type in apache2 into the terminal it returns

    (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80

    and when i type in php5 it hangs

    Thanks for the help

  10. #10
    Join Date
    Jan 2009
    Location
    Flanders
    Beans
    Hidden!

    Smile Re: Running PHP scripts

    quick dirty installation guide:

    Code:
    $ sudo apt-get install apache2 mysql-server libapache2-mod-php4 php4-mysql phpmyadmin
    # phpmyadmin is not strictly necessary, but useful
    # if necessary
    $ sudo /etc/init.d/apache2 restart
    $ sudo /etc/init.d/mysql restart
    I used this from thread 43281 but just changed php4 tot php5 and it worked

Page 1 of 2 12 LastLast

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
  •