Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#11492 closed defect (worksforme)

BUG: php5 5.2.1_1 +apache2 +mysql5 +pear compiles with wrong mysql path

Reported by: jonblock@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: High Milestone:
Component: ports Version: 1.3.2
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), jonblock@…
Port:

Description

Installed apache2, then mysql5 from ports system, confirmed operation. Added php5 +apache2 +mysql5 +pear. Then added PEAR::DB. Using database functions results in connection errors.

phpinfo() shows that php was compiled with a reference to a working directory version of the mysql5 libraries, which is not on the system after the automatic post-install cleanup.

The configure command is: './configure' '--prefix=/opt/local' '--mandir=/opt/local/share/man' '--infodir=/opt/local/share/info' '--with-config-file-path=/opt/local/etc' '--enable-calendar' '--with-iconv=/opt/local' '--enable-exif' '--enable-ftp' '--enable-wddx' '--with-zlib=/opt/local' '--with-libxml-dir=/opt/local' '--with-gettext=/opt/local' '--with-xml' '--with-expat-dir=/opt/local' '--with-xmlrpc' '--enable-soap' '--enable-filepro' '--enable-bcmath' '--enable-trans-sid' '--enable-mbstring' '--enable-dbx' '--enable-dba' '--with-openssl=/opt/local' '--with-mhash=/opt/local' '--with-mcrypt=/opt/local' '--with-tidy=/opt/local' '--with-xsl=/opt/local' '--with-imap=/opt/local' '--with-imap-ssl=/opt/local' '--with-curl=/opt/local' '--with-gd' '--with-jpeg-dir=/opt/local' '--with-png-dir=/opt/local' '--enable-gd-native-ttf' '--with-freetype-dir=/opt/local' '--enable-sqlite-utf8' '--with-ldap=/usr' '--with-kerberos=/usr' '--with-iodbc=/usr' '--with-apxs2=/opt/local/apache2/bin/apxs' '--with-mysql=/opt/local/var/db/dports/build/_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dports_www_php5/work/mysql5' '--with-pdo-mysql=/opt/local/bin/mysql_config5' '--with-mysql-sock=/opt/local/var/run/mysql5/mysqld.sock' '--with-mysqli=/opt/local/bin/mysql_config5' '--with-pear=/opt/local/lib/php'

Note the long entry for --with-mysql=. That directory does not exist on my system.

I can trace the instruction back to line 172 of the php5 Portfile, where there is a reference to ${workpath} instead of ${prefix} as used elsewhere. The next few lines (177-179) are a bit confusing, as they almost imply that this is deliberate. My ability to comprehend tapers off at that point.

Anyway, I'm in a bit of a bind now. Any resolution would be appreciated.

Change History (11)

comment:1 Changed 17 years ago by markd@…

Cc: ryandesign@… added

Pinging maintainer, since I've heard this may be necessary.

comment:2 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Milestone: Available Ports

Mark, thank you for pinging me.

Jon, yes, php5 has used that long path for --with-mysql for a long time now. That path exists during the build, and is then removed when you clean the port. (And I think the port auto-cleans by default when it's done installing.) As far as I'm aware, this is all ok and normal. I can use MySQL from within PHP with no problems with my MacPorts installation. What problems are you experiencing?

comment:3 Changed 17 years ago by jonblock@…

Hmmmm...

It was something along the lines of DB Connect Failed (I've shut down the site for the time being). As far as I could tell, everything *should* be working fine. I can connect to the DB from the mysql5 command in the shell, using the PHP credentials.

I'll have to wait until tonight to try again. I also installed Rails on the server, but I don't think I tried the database connection function yet. That might be informative.

Thanks, -Jonathan

comment:4 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

How are you connecting to the database? Via the hostname "localhost"? If so, it doesn't use TCP/IP to connect, but rather uses the MySQL socket file. You may need to edit the php.ini to tell it where the socket file is.

comment:5 Changed 17 years ago by jonblock@…

I just confirmed that Rails can see the database. It also looks like the socket file reference is already correct.

I'm still a bit uncertain about the path settings. In phpinfo(), under the mysql section, these two rows still seem wrong to me:

MYSQL_INCLUDE -I/opt/local/var/db/dports/build/_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dports_www_php5/work/mysql5/include/mysql

MYSQL_LIBS -L/opt/local/var/db/dports/build/_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dports_www_php5/work/mysql5/lib/mysql -lmysqlclient

comment:6 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Those lines in the phpinfo() are normal and not a problem. They are a site-effect of the way that php5 builds with mysql5 support.

Look rather at the configuration directives "mysql.default_socket" and "mysqli.default_socket". By default on MacPorts these will be "/opt/local/var/run/mysql5/mysqld.sock", which is correct for the MacPorts mysql5 server. However, for the mysql.com version of the server, you will probably want both of these set to "/tmp/mysql.sock". At least I think that's where they put it.

comment:7 Changed 17 years ago by pipping@…

Milestone: Available PortsPort Bugs

comment:8 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jonblock@… added

Adding reporter to Cc, in case he hasn't seen my reply.

comment:9 Changed 17 years ago by jonblock@…

Thanks for the bump. I turned my attention elsewhere, but I'll check the socket suggestion when I have a chance.

comment:10 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: worksforme
Status: newclosed

Since I haven't heard back and I believe this to be a non-issue I'll close the ticket. If you still experience the problem please feel free to reopen the ticket, or if Trac won't let you, email me and I'll do it.

comment:11 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.