Hello, Does anyone know how to modify the php5 port file to let it work with a binary install of MySQL5 that I installed using the installer found on mysql.com? I think only part of the port file has to be changed: variant mysql5 conflicts mysql3 mysql4 { depends_lib-append \ port:mysql5 configure.args-delete \ --without-mysql configure.args-append \ --with-mysql=${workpath}/mysql5 \ --with-pdo-mysql=${prefix}/bin/mysql_config5 \ --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock \ --with-mysqli=${prefix}/bin/mysql_config5 post-extract { file mkdir "${workpath}/mysql5" file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5" file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/ mysql5" } } The mysql5 directory that the installer uses is: /usr/local/ mysql-5.0.37-osx10.4-i686/ and it contains the bin, lib, include, data, etc folders. The sock file is at /tmp/mysqld.sock. I would appreciate any help in changing the above to work with my MySQL5 install. Thanks! Karl
On Apr 14, 2007, at 12:16, Karl Timmermann wrote:
Does anyone know how to modify the php5 port file to let it work with a binary install of MySQL5 that I installed using the installer found on mysql.com? I think only part of the port file has to be changed:
variant mysql5 conflicts mysql3 mysql4 { depends_lib-append \ port:mysql5 configure.args-delete \ --without-mysql configure.args-append \ --with-mysql=${workpath}/mysql5 \ --with-pdo-mysql=${prefix}/bin/mysql_config5 \ --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock \ --with-mysqli=${prefix}/bin/mysql_config5 post-extract { file mkdir "${workpath}/mysql5" file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5" file link -symbolic "${workpath}/mysql5/include" "${prefix}/ include/mysql5" } }
The mysql5 directory that the installer uses is: /usr/local/ mysql-5.0.37-osx10.4-i686/ and it contains the bin, lib, include, data, etc folders. The sock file is at /tmp/mysqld.sock.
I would appreciate any help in changing the above to work with my MySQL5 install.
First I will tell you how to do it. Then I will tell you why you should not do it. :-) I believe the mysql.com installers put a symlink at /usr/local/mysql which points to the current version. So I'll use that instead of specifying the complete directory name. So. To use the mysql.com packages, change the mysql5 variant to read: variant mysql5 conflicts mysql3 mysql4 { configure.args-delete \ --without-mysql configure.args-append \ --with-mysql=/usr/local/mysql \ --with-pdo-mysql=/usr/local/mysql/bin/mysql_config \ --with-mysql-sock=/tmp/mysqld.sock \ --with-mysqli=/usr/local/mysql/bin/mysql_config } Note that this is just off the top of my head; I haven't tested it. The reason you should not do this, or at least the reason why I do not presently include a variant like this in the php5 portfile, is that it is MacPorts policy to use its own versions of software unless there is a compelling reason not to. What is your reason for not using the MacPorts version of mysql5? This MacPorts policy is documented here along with some reasons why it is in place: http://trac.macosforge.org/projects/macports/wiki/ FAQ#WhyisMacPortsusingitsownlibraries
On Apr 14, 2007, at 5:29 PM, Ryan Schmidt wrote:
The reason you should not do this, or at least the reason why I do not presently include a variant like this in the php5 portfile, is that it is MacPorts policy to use its own versions of software unless there is a compelling reason not to. What is your reason for not using the MacPorts version of mysql5?
First, thank you very much for the instructions on how to modify the port file. As to your other question, I have a lot of programs that are looking for mysql in the normal place. Also, I mentioned in another post that I was having problems with localhost mapping to the socket file - the port uses a custom location for the socket file, and a lot of my programs don't map correctly when connecting to localhost. Another reason is the MySQL binary comes with a nice pref pane to turn it on and off and to start it up on boot up. I guess I just like it more "Mac like". :-) However, perhaps I could use the ports if I made proper symbolic links everywhere - then everything should work, including the pref pane. I could do this, or modify the port file to change the file paths. Do you recommend this instead? Thanks again, Karl
At 02:09 -0400 15/4/07, Karl Timmermann wrote:
On Apr 14, 2007, at 5:29 PM, Ryan Schmidt wrote:
The reason you should not do this, or at least the reason why I do not presently include a variant like this in the php5 portfile, is that it is MacPorts policy to use its own versions of software unless there is a compelling reason not to. What is your reason for not using the MacPorts version of mysql5?
First, thank you very much for the instructions on how to modify the port file. As to your other question, I have a lot of programs that are looking for mysql in the normal place. Also, I mentioned in another post that I was having problems with localhost mapping to the socket file - the port uses a custom location for the socket file, and a lot of my programs don't map correctly when connecting to localhost. Another reason is the MySQL binary comes with a nice pref pane to turn it on and off and to start it up on boot up. I guess I just like it more "Mac like". :-)
However, perhaps I could use the ports if I made proper symbolic links everywhere - then everything should work, including the pref pane. I could do this, or modify the port file to change the file paths. Do you recommend this instead?
Thanks again, Karl
The MySQL GUI Tools seem to work fine with the MacPorts built MySQL. http://dev.mysql.com/downloads/gui-tools/5.0.html Mark
On Apr 15, 2007, at 01:09, Karl Timmermann wrote:
On Apr 14, 2007, at 5:29 PM, Ryan Schmidt wrote:
The reason you should not do this, or at least the reason why I do not presently include a variant like this in the php5 portfile, is that it is MacPorts policy to use its own versions of software unless there is a compelling reason not to. What is your reason for not using the MacPorts version of mysql5?
First, thank you very much for the instructions on how to modify the port file. As to your other question, I have a lot of programs that are looking for mysql in the normal place.
These "lot of programs": are we talking about shell scripts here or php scripts or compiled C programs or what kinds of programs?
Also, I mentioned in another post that I was having problems with localhost mapping to the socket file - the port uses a custom location for the socket file, and a lot of my programs don't map correctly when connecting to localhost.
Yes, we need to solve that problem, and I am attempting to help you with that. If these other programs of yours are shell scripts, and they are using the MacPorts mysql5 client, then they should already know where this custom socket file is without being told anything. If these other programs are binaries which are linking with the MacPorts mysql5 libraries (for example, if you're using a php script running in the MacPorts version of php5 linked against the MacPorts mysql5 libraries), then it too will already know where the socket is and everything will just work. If you're using a php compiled against someone else's MySQL libraries and therefore it doesn't already know where the socket is, you can tell it by modifying the appropriate directive in the php.ini*. I need more information about your setup to try to understand why it's not "just working" for you. * The exception might be if you're using mysqli in php5. I haven't yet figured out how to tell mysqli where the socket is. This may be a php bug, a documentation deficiency, or a Ryan didn't look hard enough.
Another reason is the MySQL binary comes with a nice pref pane to turn it on and off and to start it up on boot up. I guess I just like it more "Mac like". :-)
The prefpane does not start MySQL at boot up. The StartupItem does. The prefpane merely changes a setting somewhere (well, a line in /etc/ hostconfig, to be exact) that tells the StartupItem whether or not to start the mysqld daemon when your Mac boots. And the prefpane can also start and stop the daemon immediately. MacPorts provides no prefpanes, true. Instead, when on 10.4, it uses the standard method of starting and stopping daemons: launchd. To start mysql5 now, and start it at every system startup, you use: sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist To stop mysql5 now, and stop it from starting at every system startup, use: sudo launchctl unload -w /Library/LaunchDaemons/ org.macports.mysql5.plist Once you know these commands, this knowledge applies to *all* daemons installed by MacPorts (and any daemons installed outside of MacPorts that use launchd). Whereas your MySQL prefpane is a solution only for MySQL, and each other daemon you have installed may have its own way of being started and stopped, and that's more confusing. Better to learn the One True Way to start daemons and use it for everything. Maybe someone has even written a prefpane to manage all your LaunchDaemons? That would be cool.
However, perhaps I could use the ports if I made proper symbolic links everywhere - then everything should work, including the pref pane. I could do this, or modify the port file to change the file paths. Do you recommend this instead?
I would not really recommend modifying the portfile. The reason is that your changes will be overwritten next time you port sync. Unless you set up your own local port tree. Which you could do. And keep your own private version of php5. But then you won't receive any updates I make to the real php5 portfile. So that might be bad. Making symlinks might work. But let's understand first where you think you need to make symlinks and why. Is it because you have some scripts that call /usr/local/mysql/bin/mysql directly? If so, then your choice is either to replace those calls with calls to /opt/local/ lib/mysql5/bin/mysql (or /opt/local/bin/mysql5, same difference), or go to /usr/local, make a directory mysql, make a directory bin inside that, and make a symlink mysql in that. Your prefpane probably needs to call mysqladmin to do its thing, so if you insist on continuing to use it you might make a symlink to that too. Though, now that I think about it, the prefpane may also assume you're using the old StartupItem from mysql.com and it might not play will with the new LaunchDaemon start/stop method used by the MacPorts version.
participants (3)
-
Karl Timmermann
-
Mark Hattam
-
Ryan Schmidt