Problems installing LAMP - MySQL and PHP5

Discussion in 'Server Operation' started by JosBR, Dec 17, 2009.

  1. JosBR

    JosBR New Member

    Hi all,

    First time here.

    Working for days now to get Apache, Mysql and PHP5 installed.
    Linux is Linux Mint Helena.
    Newbie on installing Lamp on Ubuntu/ Linux Mint.

    I am working according the procedure outlined in

    http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-9.10-lamp

    Submitted by falko.

    Problem 1 MySQL:

    When i did the install of MySQL I got the following error message. I am posting the complete tekst, so you are able to see the context:

    Setting up mysql-server-core-5.1 (5.1.37-1ubuntu5) ...
    Setting up mysql-server-5.1 (5.1.37-1ubuntu5) ...
    * Stopping MySQL database server mysqld [ OK ]
    * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    * Starting MySQL database server mysqld [ OK ]
    /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.1 (--configure):
    subprocess installed post-installation script returned error exit status 127

    Setting up mysql-client (5.1.37-1ubuntu5) ...
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-server-5.1; however:
    Package mysql-server-5.1 is not configured yet.
    dpkg: error processing mysql-server (--configure):
    dependency problems - leaving unconfigured

    No apport report written because the error message indicates its a followup error from a previous failure.
    Errors were encountered while processing:
    mysql-server-5.1
    mysql-server
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    A package failed to install. Trying to recover:
    Setting up mysql-server-5.1 (5.1.37-1ubuntu5) ...
    * Stopping MySQL database server mysqld [ OK ]
    * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    * Starting MySQL database server mysqld [ OK ]
    /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.1 (--configure):
    subprocess installed post-installation script returned error exit status 127
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-server-5.1; however:
    Package mysql-server-5.1 is not configured yet.
    dpkg: error processing mysql-server (--configure):
    dependency problems - leaving unconfigured
    Errors were encountered while processing:
    mysql-server-5.1

    mysql-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Reading extended state information
    Initializing package states... Done

    Can anyone tell me have to deal with these error messages?

    Problem 2: PHP5

    Here is the installation report PHP5:

    Dell ~ # aptitude install php5 libapache2-mod-php5
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Reading extended state information
    Initializing package states... Done
    The following NEW packages will be installed:
    apache2-mpm-prefork{a} libapache2-mod-php5 php5 php5-common{a}
    The following packages will be REMOVED:
    apache2-mpm-worker{a}
    The following partially installed packages will be configured:
    mysql-server mysql-server-5.1
    0 packages upgraded, 4 newly installed, 1 to remove and 130 not upgraded.
    Need to get 0B/2,930kB of archives. After unpacking 6,308kB will be used.
    Do you want to continue? [Y/n/?] y
    Writing extended state information... Done
    dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
    apache2 depends on apache2-mpm-worker (>= 2.2.12-1ubuntu2.1) | apache2-mpm-prefork (>= 2.2.12-1ubuntu2.1) | apache2-mpm-event (>= 2.2.12-1ubuntu2.1) | apache2-mpm-itk (>= 2.2.12-1ubuntu2.1); however:
    Package apache2-mpm-worker is to be removed.
    Package apache2-mpm-prefork is not installed.
    Package apache2-mpm-event is not installed.
    Package apache2-mpm-itk is not installed.
    (Reading database ... 127493 files and directories currently installed.)
    Removing apache2-mpm-worker ...
    * Stopping web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    ... waiting . [ OK ]
    Selecting previously deselected package apache2-mpm-prefork.
    (Reading database ... 127485 files and directories currently installed.)
    Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.12-1ubuntu2.1_all.deb) ...
    Selecting previously deselected package php5-common.
    Unpacking php5-common (from .../php5-common_5.2.10.dfsg.1-2ubuntu6.3_i386.deb) ...
    Selecting previously deselected package libapache2-mod-php5.
    Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.2.10.dfsg.1-2ubuntu6.3_i386.deb) ...
    Selecting previously deselected package php5.
    Unpacking php5 (from .../php5_5.2.10.dfsg.1-2ubuntu6.3_all.deb) ...
    Setting up mysql-server-5.1 (5.1.37-1ubuntu5) ...
    * Stopping MySQL database server mysqld [ OK ]
    * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    * Starting MySQL database server mysqld [ OK ]
    /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.1 (--configure):
    subprocess installed post-installation script returned error exit status 127
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-server-5.1; however:
    Package mysql-server-5.1 is not configured yet.
    dpkg: error processing mysql-server (--configure):
    dependency problems - leaving unconfigured
    Setting up apache2-mpm-prefork (2.2.12-1ubuntu2.1) ...
    No apport report written because the error message indicates its a followup error from a previous failure.
    * Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    [ OK ]

    Setting up php5-common (5.2.10.dfsg.1-2ubuntu6.3) ...
    Setting up libapache2-mod-php5 (5.2.10.dfsg.1-2ubuntu6.3) ...
    Not replacing deleted config file /etc/php5/apache2/php.ini

    Setting up php5 (5.2.10.dfsg.1-2ubuntu6.3) ...
    Errors were encountered while processing:
    mysql-server-5.1
    mysql-server
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    A package failed to install. Trying to recover:
    Setting up mysql-server-5.1 (5.1.37-1ubuntu5) ...
    * Stopping MySQL database server mysqld [ OK ]
    * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    * Starting MySQL database server mysqld [ OK ]
    /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.1 (--configure):
    subprocess installed post-installation script returned error exit status 127
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-server-5.1; however:
    Package mysql-server-5.1 is not configured yet.
    dpkg: error processing mysql-server (--configure):
    dependency problems - leaving unconfigured
    Errors were encountered while processing:
    mysql-server-5.1
    mysql-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Reading extended state information
    Initializing package states... Done
    Writing extended state information... Done

    When I enter http://localhost, in Firefox I get : It works....etc

    When I enter http://localhost/info.php, Firefox is asking me what I want to do with the info.php file, assuming that PHP5 is not working.

    I appreciate any help.

    My best

    Jos
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Can you post the output of
    Code:
    df -h
    ?
     
  3. JosBR

    JosBR New Member

    Post Output

    Sure. Here it is:

    Dell jos # df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 285G 14G 257G 6% /
    udev 1.5G 340K 1.5G 1% /dev
    none 1.5G 580K 1.5G 1% /dev/shm
    none 1.5G 336K 1.5G 1% /var/run
    none 1.5G 0 1.5G 0% /var/lock
    none 1.5G 0 1.5G 0% /lib/init/rw
    /dev/sdb5 211G 2.9G 197G 2% /media/4466ccbe-3862-42f8-89b2-d0c127d00480___
    /dev/sdb1 244G 40G 205G 17% /media/CC80FD1B80FD0CA8__
    Dell jos #
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Hm, hard disk space is not the problem. What's in /etc/apt/sources.list?
     
  5. JosBR

    JosBR New Member

    Found the solution-it all works now

    First of all thanks to Falko for his commitment to help me.

    I sorted all out in the meantime ( about 2 days work) and will share the solution with this forum.

    Trigger for the solution was:

    https://help.ubuntu.com/9.10/serverguide/C/index.html

    Chapters 10 and 11.
    Very useful teaching.

    MySQL problems:
    1) /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read.
    Solution:

    copy Debian.cnf to my.cnf

    2) /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    Solution:
    copy _etc_mysql_debian-start in /usr/share/mysql-common/internal-use-only
    to: /etc/mysql/debian-start

    After these action MySQL worked without a problem.

    PHP5 problems:
    This, in the Ubuntu server guide was critical to the solution:

    Please verify if the files /etc/apache2/mods-enabled/php5.conf and /etc/apache2/mods-enabled/php5.load exist. If they do not exists, you can enable the module using a2enmod command.

    I used the a2enmod to activate php5 and another, If I remember well, it was php5-mysql.

    I still had some problems left with configuring the Apache server. Could not manage to set up the virtual hosts. What I did was changing the default in /etc/apache2/sites-available like this:

    <VirtualHost *:80>
    ServerAdmin [email protected]

    DirectoryIndex index.php index.html

    DocumentRoot /home/blah/MySites

    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>

    <Directory /home/blah/MySites/p4u-final>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>


    Although I am still puzzled about the Virtual Server thing, it works now.

    I installed PHPmyadmin without any problems, using the Ubuntu server guide instructions.

    Hope this was helpfull,

    My best,

    Jos B. Rikhof
    Originator of www.peru4u.com
     
  6. JosBR

    JosBR New Member

    Posting the solution

    I sorted out the problems and I am posting the solution to this forum.

    Triggering the solution was:
    https://help.ubuntu.com/9.10/serverguide/C/index.html
    Pick your item in chapters 10,11,12

    Problems MySQL:
    WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    Solution:
    I copied Debian.cnf which was in /etc/mysql/ to /etc/mysql/my.cnf

    /etc/init.d/mysql: line 123: /etc/mysql/debian-start: No such file or directory
    I found _etc_mysql_debian-start in /usr/share/mysql-common/internal-use-only
    and copied this file to:
    /etc/mysql/debian-start

    After that MySQL ran without any problem. No error messages at start up of the server anymore.

    I guess it is something for the package manager to work improve.

    Problems PHP5:

    Trigering the solution to these problems was:

    Please verify if the files /etc/apache2/mods-enabled/php5.conf and /etc/apache2/mods-enabled/php5.load exist. If they do not exists, you can enable the module using a2enmod command.

    in the Ubuntu server guide.

    I opened the terminal and did: a2enmode php5 and php5-mysql ( If I remember well)

    After that I could read the php.info file. So PHP was activated.

    The only thing that still gave problems was configuring the Virtual host(s) in apache. I did a workaround and changed the default in /sites-available file like this:

    <VirtualHost *:80>
    ServerAdmin [email protected]

    DirectoryIndex index.php index.html

    DocumentRoot /home/jos/Sites

    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>

    <Directory /home/jos/Sites/p4u-final>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    </VirtualHost>


    I still do not feel comfortable with that, but at least it works.

    My best,

    Jos B. Rikhof
    Originator of http://www.peru4u.com
     

Share This Page