Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I'm very new to Linux, running Ubuntu 9.04 on my old laptop. I have installed Apache, MySQL and PHP, but it doesn't all work. I can browse to localhost and ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40

    [SOLVED] Problems with installing Apache, MySQL, PHP

    I'm very new to Linux, running Ubuntu 9.04 on my old laptop. I have installed Apache, MySQL and PHP, but it doesn't all work. I can browse to localhost and get a successful message "It works!". Then I create a file phpinfo.php with the following code:
    Code:
    <?php
    phpinfo();
    ?>
    and copy it to /usr/local/apache2/htdocs. I now browse to localhost/phpinfo.php, but I get:

    Code:
    Not Found
    The requested URL /phpinfo.php was not found on this server.
    Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch Server at localhost Port 80
    I'm sure I made mistakes during installation, but I tried to start over and do a clean installation. I think my first mistake was to follow instructions from 2 different books I bought. I installed MySQL following instructions from the book Ubuntu Unleashed 2008 version (for 8.04), although I'm on 9.04. The instruction was to run:

    Code:
    sudo mysql_install_db
    This worked, because I was able to connect to MySQL and create a sample database.

    A few days later, I bought another book Sams Teach Yourself PHP, MySQL and Apache, that included a CD to install Apache, PHP and MySQL, so I installed Apache from that CD. As noted above, I can connect to localhost successfully. I then followed the instructions to install PHP from the CD, but at this point I can't connect to localhost/phpinfo.php.

    At this point, I started Googleing and came to the conclusion that I shouldn't have done such a mixed installation. I tried uninstalling everything and then installing from the Synaptic Package Manager. After doing all of that, I'm at the same place I started. Apache works, but I can't get the PHP connection to work. And now my MySQL isn't working.

    Can someone help me uninstall PHP, MySQL and Apache the proper way so that I start with a blank slate? and also tell me where I can find the correct way to do this installation?

  2. #2
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    I have proceeded with removing my installations of Apache, PHP and MySQL. First, I listed the installed applications by running each of these commands.

    Code:
    dpkg --get-selections |grep php
    dpkg --get-selections |grep apache
    dpkg --get-selections |grep mysql
    Then, I used the results to build the apt-get remove statments:

    Code:
    sudo apt-get remove --purge apache2 ....(etc.)....
    However, in the end, I still have the following:

    Code:
    $ dpkg --get-selections |grep mysql
    libmysqlclient16				deinstall
    mysql-client-5.1				deinstall
    mysql-server-5.1				deinstall
    Can someone tell me what this means? Is MySQL still not completely uninstalled? Am I doing the correct way to uninstall? Following the complete uninstall, what is the best way for me to re-install Apache, PHP and MySQL in Ubuntu 9.04?

  3. #3
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    Also, when I look browse my folders, I still see the following folders:

    Code:
    /etc/mysql
    /etc/php5/apache2
    /usr/local/apache2
    /usr/local/php
    Is this supposed to be there after I completed the removals?

  4. #4
    Just Joined!
    Join Date
    Apr 2009
    Location
    Berkeley, California
    Posts
    20
    Quote Originally Posted by mrs1179 View Post
    Also, when I look browse my folders, I still see the following folders:

    Code:
    /etc/mysql
    /etc/php5/apache2
    /usr/local/apache2
    /usr/local/php
    Is this supposed to be there after I completed the removals?
    Are there files in the folders?

  5. #5
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    Are there files in the folders?
    /etc/mysql - has 2 files,
    -rw------- 1 root root 333 2009-05-25 22:00 debian.cnf
    -rwxr-xr-x 1 root root 1198 2009-03-02 20:41 debian-start

    /etc/php5/apache2 - is empty

    /usr/local/apache2 - has 68 files under the following:
    drwxr-xr-x 15 root root 4096 2009-05-28 22:30 .
    drwxr-xr-x 12 root root 4096 2009-05-31 15:39 ..
    drwxr-xr-x 2 root root 4096 2009-05-28 22:30 bin
    drwxr-xr-x 2 root root 4096 2009-05-28 22:30 build
    drwxr-xr-x 2 root root 4096 2009-05-28 22:30 cgi-bin
    drwxr-xr-x 4 root root 4096 2009-05-31 17:35 conf
    drwxr-xr-x 3 root root 4096 2009-05-28 22:30 error
    drwxr-xr-x 2 root root 4096 2009-05-30 13:21 htdocs
    drwxr-xr-x 3 root root 4096 2009-05-28 22:30 icons
    drwxr-xr-x 2 root root 4096 2009-05-28 22:30 include
    drwxr-xr-x 3 root root 4096 2009-05-28 22:30 lib

    /usr/local/php - has 28 files under the following:
    drwxr-xr-x 7 root root 4096 2009-05-31 15:39 .
    drwxr-xr-x 12 root root 4096 2009-05-31 15:39 ..
    drwxr-xr-x 2 root root 4096 2009-05-31 17:36 bin
    drwxr-xr-x 2 root root 4096 2009-05-31 15:39 etc
    drwxr-xr-x 3 root root 4096 2009-05-31 15:39 include
    drwxr-xr-x 3 root root 4096 2009-05-31 15:39 lib
    drwxr-xr-x 3 root root 4096 2009-05-31 15:39 man

  6. #6
    Just Joined!
    Join Date
    May 2009
    Posts
    14
    Brother, Copy it to /var/apache/www/


  7. #7
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    Brother, Copy it to /var/apache/www/
    I don't have /var/apache/www, but I have /var/www. Yesterday I copied phpinfo.php to /var/www, and the browser found the file phpinfo.php, but did not recognize the php extension. Today, when I browse to Not found, nothing happens at all. I just get a blank page, with no error messages or anything else.

    The book I was following said to add the following to /usr/local/apache2/conf/httpd.conf, which is supposed to tell the web server to process any .php file as a PHP script.

    Code:
    AddType application/x-httpd-php .php .html
    But, this does not do the trick. I'm still searching for what it takes to get Apache to recognize PHP, but haven't found the right thing yet.

  8. #8
    Just Joined!
    Join Date
    May 2009
    Posts
    14
    Re-Install PHP

  9. #9
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    Re-Install PHP
    I had already reinstalled Apache and PHP yesterday, but uninstalled and reinstalled PHP again now, and rebooted my machine to ensure Apache restarts fresh with new PHP. Then I cleared browser cache, and navigated back to
    HTML Code:
    http://localhost/phpinfo.php
    . I'm still getting the same result, that is, nothing is dispayed.

  10. #10
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,946
    In the /etc/apache2 directory where your httpd.conf file is, do you have Document Root set to /var/www/htdocs? Do you have a Document root set in your php.ini file? Usually in the /etc directory, under php5 or apache2. What permissions do you have on your php files and the mysql files in /var/lib?

    I've seen a number of tutorials on LAMP servers on Ubuntu but don't use Ubuntu so I don't know how useful they would be?

Page 1 of 2 1 2 LastLast

Posting Permissions

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