LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   LAMP on FC4 (https://www.linuxquestions.org/questions/linux-software-2/lamp-on-fc4-513734/)

Decoy[403] 12-26-2006 05:14 AM

LAMP on FC4
 
hi there,

I was going to update PHP, Apache and MySQL on my Fedora Core 4 with yum, so I've run this command by root:
Code:

# yum update apache mysql php
Looks like everything is OK...
Quote:

Dec 24 23:30:51 Updated: mysql.i386 4.1.20-1.FC4.1
Dec 24 23:30:53 Updated: php.i386 5.0.4-10.5
Dec 24 23:30:53 Updated: php-ldap.i386 5.0.4-10.5
Dec 24 23:31:01 Updated: php-pear.i386 5.0.4-10.5
Dec 24 23:31:06 Updated: mysql-devel.i386 4.1.20-1.FC4.1
Dec 24 23:31:06 Updated: php-gd.i386 5.0.4-10.5
Dec 24 23:31:07 Updated: php-mbstring.i386 5.0.4-10.5
Dec 24 23:31:25 Updated: mysql-server.i386 4.1.20-1.FC4.1
With fresh software my site powered by PHP+MySQL and hosted on this machine is refused to work!
Quote:

ERROR_NO_COMMUNICATION_WITH_SERVER
Here is message in log:
Quote:

[client XXX.XXX.XXX.XXX] PHP Notice: Use of undefined constant ERROR_NO_COMMUNICATION_WITH_SERVER - assumed 'ERROR_NO_COMMUNICATION_WITH_SERVER' in /path/to/script/dbconnect.php on line 9
Before performing update everything was fine!.. :( So I've put <? phpinfo() ?> into test.php in my webserver folder and fire up my browser at http://localhost/test.php. It shows me that php was builded with defaults (--without-mysql)!!! Argh. I've make these actions
Code:

# yum remove php
# yum install php php-mysql php-xml

and checked /var/log/yum.log
Quote:

Dec 25 13:48:42 Erased: php
Dec 25 13:48:43 Erased: php-pear
Dec 25 13:48:45 Erased: php-ldap
Dec 25 13:48:45 Erased: php-mbstring
Dec 25 13:48:45 Erased: php-gd
Dec 25 14:05:21 Installed: php.i386 5.0.4-10.5
Dec 25 14:05:21 Installed: php-ldap.i386 5.0.4-10.5
Dec 25 14:05:21 Installed: php-mysql.i386 5.0.4-10.5
Dec 25 14:05:23 Installed: php-pear.i386 5.0.4-10.5
Dec 25 14:05:23 Installed: php-gd.i386 5.0.4-10.5
Dec 25 14:05:23 Installed: php-mbstring.i386 5.0.4-10.5
Dec 25 14:18:29 Installed: php-xml.i386 5.0.4-10.5
After installing php-mysql my scripts started to work with one correction: I have to use $host = 127.0.0.1 instead of $host = localhost
Code:

$link = @mysql_connect($host,$dbuser,$dbpwd) or die(ERROR_NO_COMMUNICATION_WITH_SERVER);
My site works only in this case! :(
Code:

$link=mysql_connect(localhost,$dbuser,$dbpwd);
echo mysql_error();

returns
Quote:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)mysql_connect
Any ideas?

jonaskoelker 12-27-2006 07:09 PM

My observations: in one case you have an '@', in the other you don't. Also, your use of `localhost' seems very barewordy to me. I'm no PHP expert, by far, but see where these two ideas go.

Decoy[403] 12-28-2006 06:27 AM

First of all, thanks for paying attention to my problem! :)
Missing '@' was misprint. In the code '@' is present.
The problem is that sourcecodes (php-scripts) were not modified! They worked perfectly with old software. Trouble with mysqlconnect appears only after updating software. Note that software wasn't updated to critically new versions!..

pk21 12-28-2006 07:55 AM

don't know which php version you were running before, but there are big diferences between php 4 and 5 of course.
Maybe you can also check your localhost entry in /etc/hosts to see if it still points to 127.0.0.1

Decoy[403] 12-29-2006 02:12 AM

Quote:

Originally Posted by pk21
don't know which php version you were running before, but there are big diferences between php 4 and 5 of course.

It was PHP 5.0.4. I'm curious why yum updated php from 5.0.4 up to 5.0.4! 8) Maybe there was an error in repo but then it shouldn't update anything!
Quote:

Originally Posted by pk21
Maybe you can also check your localhost entry in /etc/hosts to see if it still points to 127.0.0.1

Seems like OK
Code:

$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1              localhost.localdomain localhost


Nylex 12-29-2006 02:14 AM

Is your MySQL server actually running?

Decoy[403] 01-03-2007 01:40 AM

Sure. I can connect it via ip address 127.0.0.1 but not hostname localhost...


All times are GMT -5. The time now is 06:18 AM.