PHP - Installation Problem

Questions about programming languages and debugging
Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

PHP - Installation Problem

Post by Dltr »

I was trying to install Apache2 With PHP5 And MySQL Support On Ubuntu 9.10 (LAMP).
So i run all Steps for the Installation as Root,Then i started to install
MySQL 5 BUT the first Problem was that there was no asking to provide a password for the MySQL root user
and The Result of this :
aptitude install mysql-server mysql-client
Was This Error:
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
And guess What ... I get the same Error when i install Apache2 after typing this in the Terminal
aptitude install apache2
And I assume that if everything was going correct then i would be able to direct my browser to http://192.168.0.100, and i suppose to see the Apache2 placeholder page (It works!) .. :-k

So i don't really know where the Problem is :roll: , Can anyone Help !!

Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

first make sure you really ARE logged in as root user, then remove the lockfile manually:

Code: Select all

rm /var/lib/dpkg/lock
next clean up eventual apt errors:

Code: Select all

apt-get install -f
apt-get clean
apt-get update
apt-get upgrade
when everything went fine (no errors) you need to install the missing packages, I list all needed packages for Apache2/PHP5/MySQL5 here, don't worry, if you already have some of them installed it will simply skip them, so it's safe to use. I also added some packages that are not REALLY needed, but installing them will provide you the full possible features:

MySQL5, I've added phpmyadmin too:

Code: Select all

apt-get install mysql-server mysql-client libmysqlclient15-dev phpmyadmin
when done set the MySQL root password:

Code: Select all

mysqladmin -u root password YourPasswordHere
next is apache2:

Code: Select all

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2.2-common apache2-utils libexpat1 ssl-cert
then PHP5:

Code: Select all

apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
you should have a fully working apache server with mysql/php support afterwards, in case problems appear just ask... :wink:
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

Thank You Bad_Brain for Replying :D
I have done all Steps and everything is gone Perfectly ..


Except This Step here :

Code: Select all

mysqladmin -u root password YourPasswordHere
So i typed myspladmin -u root password (My Password)

Then i get this here :
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'



Thnank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

hm, ok, can you access mysql? simply enter:

Code: Select all

mysql
if you are prompted for a password (shouldn't happen if you are logged in as root) try the regular root user password or simply press return to use no password.
once you get the mysql> prompt do:

Code: Select all

SET PASSWORD FOR root = PASSWORD('password_here');
and leave with "quit".

another option would be to access phpmyadmin:
http://192.168.0.100/phpmyadmin
if I remember it right you can set the password there too (if there is none set yet)... :-k
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

i typed mysql , Then i got this :

Code: Select all

dltr-clone@Dltr:~$ mysql
ERROR 1045 (28000): Access denied for user 'dltr-clone'@'localhost' (using password: NO)
Then said to myself ok how would it be if typed mysql if i access as Root by typing

Code: Select all

sudo su
then i get the same Error .

... hmm i don't understand why can't i access the mysql Prombt !


Thank You
Dltr

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

Edit fqdn file to access your site. We usually use localhost to be connected on our site.

$ sudo pico /etc/apache2/conf.d/fqdn

Copy bellow code then paste into fqdn

ServerName localhost
Got this in from a Tutorial i found in google.That's what i don't get because everytime when i do this Command and go to the browser and type http://localhost , The Result is :

Code: Select all

Unable to connect
Firefox can't establish a connection to the server at localhost.
*   The site could be temporarily unavailable or too busy. Try again in a few
moments.
*   If you are unable to load any pages, check your computer's network
connection.
*   If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.

*Note : Just for Obeying and Considering Rules of The Site,I hope making a New Post wouldn't make a Trouble,Otherwise I Could Edit The Above-Mentioned Informations to The Last Post which has been written on Day Thu Jan 28 2010,Time 12:41 am by Dltr .

Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

first of all, log in as root from the start, this whole sudo-stuff is kinda annoying... :lol:
make sure you are root:

Code: Select all

whoami
it should return "root" then.

then try to login:

Code: Select all

mysql
if it's not working try:

Code: Select all

mysql -uroot -pPassword
use your regular root user password for that.
if it's also not working try:

Code: Select all

mysql -uroot -p
or simply access phpmyadmin as mentioned in my last post, if no mysql root password is set you can do it there.


about that fqdn thingy:
never heard about a fqdn file in apache, the servername is usually set in httpd.conf/apache2.conf, also "localhost" is not a fqdn, at least for me a fqdn always have to contain a dot (like suck-o.com).
to check the hostname:

Code: Select all

hostname -f
but why don't you simply use http://127.0.0.1 ?
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

first of all, log in as root from the start, this whole sudo-stuff is kinda annoying... Laughing
make sure you are root:

Code: Select all

whoami
it should return "root" then.
8O LOL :lol: , Damn :oops:

Ok here we go ... i returned to root and all Step were going fine tell this One here :

Code: Select all

mysqladmin -u root password YourPasswordHere
And for That i used

Code: Select all

mysql -uroot -pPassword
And it didn't work fine Then i used this here :

Code: Select all

mysql -uroot -p
Then i got
root@Dltr:~# mysql -uroot -p
Enter password:
Then I typed a Password Then i got This Error :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@Dltr:~#
Its really weird! ](*,)

Hoping for Things to get fine and Waiting for Reply :roll:


Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

hm, is mysql running at all? check with:

Code: Select all

ps -A|grep mysql
if it returns nothing try starting it with:

Code: Select all

/etc/init.d/mysql start
if you get an error post it... :wink:
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

Well no Errors but i got this Here :
root@Dltr:~# ps -A|grep mysql
Nothing happened then typed
root@Dltr:~# /etc/init.d/mysql start
* Starting MySQL database server mysqld [fail]

Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

ok, check syslog for the error message (/var/log/syslog) and post it...best try to start mysql and then look at the bottom of syslog, you don't need to search around then... :wink:
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »


ok, check syslog for the error message (/var/log/syslog) and post it...best try to start mysql and then look at the bottom of syslog
, you don't need to search around then...
Errrmm :oops: , What should do exactly Or what should i Type in Terminal !? :roll:


Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

hehe...^^

Code: Select all

vim /var/log/syslog
you can navigate with the arrow keys then....I highly recommend to become familiar with vim, it's an essential tool available on any *nix system.

P.S. to exit vim press : to switch into command mode, enter q (=quit) and press return... :wink:
Image

Dltr
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 210
Joined: 28 Oct 2009, 17:00
14
Location: Germany
Contact:

Post by Dltr »

Code: Select all

vim /var/log/syslog
you can navigate with the arrow keys then....I highly recommend to become familiar with vim, it's an essential tool available on any *nix system.
P.S. to exit vim press : to switch into command mode, enter q (=quit) and press return...
All Done !

Then i got remarkable things about mysql & PHP :

Code: Select all

mysqld: 100129 15:52:36 [Warning] Can't create test file /var/lib/mysql/Dltr.lower-test
mysqld: 100129 15:52:36 [Warning] Can't create test file /var/lib/mysql/Dltr.lower-test
mysqld: 100129 15:52:36 [Warning] One can only use the --user switch if running as root
mysqld: 
mysqld: 100129 15:52:36 [Note] Plugin 'FEDERATED' is disabled.
mysqld: #007/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
mysqld: 100129 15:52:36 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
mysqld: 100129 15:52:36  InnoDB: Operating system error number 13 in a file operation.
mysqld: InnoDB: The error means mysqld does not have the access rights to
mysqld: InnoDB: the directory.
mysqld: InnoDB: File name ./ibdata1
mysqld: InnoDB: File operation call: 'open'.
mysqld: InnoDB: Cannot continue operation.
mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
/etc/init.d/mysql[8918]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[8918]: Could not open required defaults file: /etc/mysql/debian.cnf
/etc/init.d/mysql[8918]: Fatal error in defaults handling. Program aborted
/etc/init.d/mysql[8918]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
/etc/init.d/mysql[8918]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
/etc/init.d/mysql[8918]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
/etc/init.d/mysql[8918]: 
mysqld: 100129 16:01:04 [Note] Plugin 'FEDERATED' is disabled.
mysqld: 100129 16:01:04  InnoDB: Started; log sequence number 0 44233
mysqld: 100129 16:01:04 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
Dltr mysqld: 100129 16:01:04 [ERROR] Do you already have another mysqld server running on port: 3306 ?
mysqld: 100129 16:01:04 [ERROR] Aborting
mysqld: 
mysqld: 100129 16:01:06  InnoDB: Shutdown completed; log sequence number 0 44233
mysqld: 100129 16:01:06 [Warning] Forcing shutdown of 1 plugins
mysqld: 100129 16:01:06 [Note] /usr/sbin/mysqld: Shutdown complete
mysqld:
CRON[2563]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)
I Really hope that's what you are meaning or looking for !:-k

By the Way found i good website for Vim Commands :

Code: Select all

http://www.tuxfiles.org/linuxhelp/vimcheat.html
http://bullium.com/support/vim.html


Thank You
Dltr

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

hmm, lots of problems, but let's focus on the last one that appeared when you tried to start it manually because it's a fatal one:
mysqld: 100129 16:01:04 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
Dltr mysqld: 100129 16:01:04 [ERROR] Do you already have another mysqld server running on port: 3306 ?
ok, let's find out what occupies the port:

Code: Select all

fuser -n tcp 3306
it will return the process ID (PID), let's say 12345 as example...
then run:

Code: Select all

ps -A
and look which process has the PID 12345...
Image

Post Reply