{"id":23,"date":"2005-08-25T10:10:00","date_gmt":"2005-08-25T10:10:00","guid":{"rendered":"http:\/\/elegans.uky.edu\/blog\/?p=23"},"modified":"2005-08-25T10:10:00","modified_gmt":"2005-08-25T10:10:00","slug":"php-mysql","status":"publish","type":"post","link":"http:\/\/jimlund.org\/blog\/?p=23","title":{"rendered":"php-mysql"},"content":{"rendered":"<p>I checked my blog, and found out that WordPress had lost PHP.<\/p>\n<p>Turns out as part of the Mysql upgrade to version 5 I had to uninstall php-mysql.<br \/>\nNo binary or package of php-mysql for Mysql version 5 is available so I had to<br \/>\ncompile it myself. It took awhile, here\u00e2\u20ac\u2122s how it went:<\/p>\n<p>The php module of Apache (httpd) incorporates mysql connection support. It is<br \/>\nbuilt as part of the php build process. So I download php-5.0.4<br \/>\n(<a href=\"http:\/\/www.php.net\/\">PHP<\/a>).<\/p>\n<p>Building the php webserver module requires the Apache source. I *really*<br \/>\ndon\u00e2\u20ac\u2122t want to totally build and replace my webserver, there are too many ways<br \/>\nto screw it up. So I\u00e2\u20ac\u2122ll just build it, and use the build for making the php<br \/>\nmodule, but not replace my working web server with the new build.<br \/>\nFind out what version of Apache is installed:<br \/>\n<code>&gr;rpm -qa | grep http<br \/>\nhttpd-devel-2.0.51-2.7<br \/>\nhttpd-2.0.51-2.7<br \/>\nsystem-config-httpd-1.2.0-3<br \/>\nhttpd-manual-2.0.51-2.7<\/code><\/p>\n<p>So find and download the httpd-2.0.51 source from the old version site,<br \/>\n<a href=\"http:\/\/archive.apache.org\/dist\/httpd\/\">old Apache<\/a><br \/>\nuntar it, and build it:<\/p>\n<p><code>.\/configure --enable-so --enable-cache --enable-cgi<br \/>\n--enable-rewrite=shared --enable-vhost-alias --enable-module=headers<br \/>\n--enable-module=perl --enable-module=log_agent --enable-module=log_referer<br \/>\n--enable-module=include<br \/>\nmake<br \/>\nmake install<\/code><\/p>\n<p>Since I won\u00e2\u20ac\u2122t use this build, the exact options aren\u00e2\u20ac\u2122t critical. This installs it in the default location, \/usr\/local\/apache2. My old version is still the active one though.<\/p>\n<p>Now go to PHP, untar and build it.<\/p>\n<p><code>.\/configure --enable-force-cgi-redirect --with-apxs2 --with-mysql=\/usr<br \/>\nmake<br \/>\nmake install<\/code><\/p>\n<p>I had to play around with the configure parameters and still got build errors:<br \/>\n<code>----------------<br \/>\n\/usr\/bin\/ld: \/usr\/lib64\/mysql\/libmysqlclient.a(libmysql.o): relocation<br \/>\nR_X86_64_32 can not be used when making a shared object; recompile with -fPIC<br \/>\n\/usr\/lib64\/mysql\/libmysqlclient.a(libmysql.o): could not read symbols: Bad<br \/>\nvalue<br \/>\n----------------<\/code><\/p>\n<p>Looking around the web, it looks like php can\u00e2\u20ac\u2122t find the shared mysql library.<br \/>\nI look at mysql:<\/p>\n<p><code>ls -l \/usr\/lib64\/*mysql*<\/code><\/p>\n<p>and see a shared library in \/usr\/lib64 and a static one in \/usr\/lib64\/mysql.<br \/>\nPHP is trying to use the \/usr\/lib64\/mysql one instead of the \/usr\/lib64 one.<br \/>\nTo fix this, I edit the Makefile, replace occurances of \/usr\/lib64\/mysql with<br \/>\n\/usr\/lib64. Then \u00e2\u20ac\u02dcmake clean\u00e2\u20ac\u2122, \u00e2\u20ac\u02dcmake\u00e2\u20ac\u2122. Now it compiles fine.<br \/>\nDo \u00e2\u20ac\u02dcmake install\u00e2\u20ac\u2122.<br \/>\nIt puts the Apache module in \/usr\/local\/apache2\/modules. Copy it to my module<br \/>\ndir:<\/p>\n<p><code>cp \/usr\/local\/apache2\/modules\/libphp5.so \/etc\/httpd\/modules<\/code><\/p>\n<p>Check that \/etc\/httpd\/conf.d\/php.conf points to it:<br \/>\nLoadModule php5_module modules\/libphp5.so<\/p>\n<p>restart the web server:<\/p>\n<p><code>\/etc\/rc.d\/init.d\/httpd restart<\/code><\/p>\n<p>and WordPress is back online!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I checked my blog, and found out that WordPress had lost PHP. Turns out as part of the Mysql upgrade to version 5 I had to uninstall php-mysql. No binary or package of php-mysql for Mysql version 5 is available so I had to compile it myself. It took awhile, here\u00e2\u20ac\u2122s how it went: The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":0,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jimlund.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}