php 5.1.2 and mysql 5.0.18 problem: "Lost connection to MySQL server during query"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!
I tried to compile a LAMP system, but I'm having troubles in making MySQL and Apache+PHP to communicate: I've compiled apache-2.2.0, and, as the title says, mysql-5.0.18 and php-5.1.2. The ./configure options I passed when building mysql-5.0.18 are:

export CFLAGS="-O2 -march=i486 -mtune=i686"
export CXXFLAGS="-O2 -march=i486 -mtune=i686"
./configure \
--prefix=/usr \
--localstatedir=/var/lib/mysql \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--without-debug \
--with-openssl=/usr \
--with-extra-charsets=all \
--with-unix-socket-path=/var/run/mysql/mysql.sock \
--with-big-tables \
--without-bench \
--program-prefix="" \
--program-suffix=""

The ./configure options I passed to PHP are:

export CFLAGS="-O2 -march=i486 -mtune=i686"
export CXXFLAGS="-O2 -march=i486 -mtune=i686"
./configure \
--prefix=/usr \
--with-apxs2=/usr/sbin/apxs \
--enable-force-cgi-redirect \
--enable-discard-path \
--enable-fastcgi \
--with-config-file-path=/etc/apache \
--enable-safe-mode \
--with-openssl=/usr \
--with-zlib=/usr \
--with-zlib-dir=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--with-curlwrappers \
--enable-dba \
--with-gdbm=/usr \
--with-db4=/usr \
--with-inifile \
--with-flatfile \
--enable-dbase \
--with-libxml-dir=/usr \
--enable-exif \
--enable-filepro \
--enable-ftp \
--with-openssl-dir=/usr \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-t1lib=/usr \
--enable-mbstring \
--with-libmbfl \
--with-mhash=/usr \
--with-mysql=shared,/usr \
--with-zlib-dir=/usr \
--enable-embedded-mysqli \
--with-ncurses=/usr \
--enable-shmop \
--with-libxml-dir=/usr \
--enable-soap \
--with-libxml-dir=/usr \
--enable-sockets \
--enable-sqlite-utf8 \
--with-regex=php \
--enable-sysvmsg \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir=/usr \
--with-pear \
--with-zend-vm=CALL \
--with-tsrm-pthreads \
--enable-shared \
--enable-static \
--program-prefix="" \
--program-suffix=""

After the compilation and installation of the 2 packages, I added to the php.ini file the line "extension=mysql.so" and added the php module to the LoadModule section of the httpd.conf file. I logged as root to the mysql user and created the database cluster with mysql_install_db . Then I started the httpd and mysql servers. As the user mysql, I logged to the mysql server database with "mysql --user=root mysql" and I created a user with "GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypass' WITH GRANT OPTION;". I put in the apache DocumentRoot the test.php file containing the following php directives:

<?php
// connect to the database; otherwise exit and return an error
mysql_connect('127.0.0.1','myuser','mypass') or die(mysql_error());
?>

When I connect to the localhost, I got the message "Lost connection to MySQL server during query". If I substitute 'localhost' to '127.0.0.1' in the mysql_connect call, I get the following output: "Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)", but the file /var/run/mysql/mysql.sock exists! Did I miss something that needed to be done to make mysql and php to communicate?
Thank you very much in advance.

Best regards,

Filippo

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux