PHP, mysqli, Solaris 10 and how not to cause yourself pain...


Its been quite some time since I've had a reason to handroll a php module (well actually its been quite some time since I've used php, but thats a different matter). Anyway I spent some time last week with a customer who is deploying a apache/mysql/php app on some v20z's running Solaris 10. Now they are very recent converts to Solaris, and the app has been in development for six or seven months, and as such it was developed on a Linux box, with very regular revs of php and mysql.

So in order to make the overall migration as easy as possible it was decided to use the same version numbers of the various components on Solaris as on the Linux box, giving us Apache 1.3.33, Mysql 4.1.12 and PHP 5.0.4. So we went forth and got the source, and started to compile, and things went south in a very self inflicted manner. Basically due to not reading up on the latest versions of php and mysql on my part we ended up doing a bunch of unneccesserary compiles, and a php module which had no interest in linking to anything,

Anyway as I said this was self inflicted, and the correct (and easiest) thing to do on Solaris 10 is the following.

  • Download the MySQL 4.1.12 package for s10 on amd64 from the mysql site.
    This will just make your life easier in the long run.
  • Grab your php 5.0.4 Source
  • Pkgadd the mysql package (pkgadd -d unarchived-pkg)
    In our case we symlinked it to /usr/mysql
  • Use the bundled apache software (do a pkginfo -l SUNWapchr to confirm the version info)
  • Compile php (taking note of the mysqli extensions)[1] with
    	# add /usr/sfw/bin for gcc, /usr/ccs/bin for make
    	#
    
         PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin; export PATH
         ./configure --with-apxs=/usr/apache/bin/apxs \\
                     --with-mysqli=/usr/mysql/bin/mysql_config \\
                     --with-mysql=/usr/mysql
         make; make install
    
Your httpd.conf needs an AddType for your php extension added in as well.

[1] This is what had caught me, not following php development that much, I wasn't aware of the mysqli interface. The moral of the story, spend fifteen minutes testing stuff before visiting a customer, even if you set up a similar config in the distant past.

Technorati Tag(s) :
Comments:

Hi, It seems you were able to configure PHP on solaris 10 and i beleive you are able to run php by now. I thought you can help me on my question. I would like to know how to test the PHP configuration, for which i ran "apachectl start" once i finished the following steps successfully. The command returns fine and i am not sure whether deamon started or not caz i did not see any process running. --------------------------------------------------------------------------------------------- Download the php-5.0.5.tar.gz file from php.net. Run gunzip and then tar. cd /export/home/chanti/downloads/php/php-5.0.5 set path for mysql and make which like: PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin; export PATH ./configure --with-apxs2=/usr/apache2/bin/apxs --with-mysql=/usr/sfw cd /etc/apache2 cp httpd.conf-example httpd.conf make make install diff httpd.conf httpd.conf.bak 281d280 < LoadModule php5_module libexec/libphp5.so Then edit 'httpd.conf' and add this AddType application/x-httpd-php .php copy php.ini to /usr/local/lib/phpps Now running /usr/apache2/bin/apachectl start and i did not see any error and any message against this command, but the prompt is returned fine. ---------------------------------------------------------------------- Thanks, Ram

Posted by Ram on September 09, 2005 at 03:21 AM IST #

Finally, i could able to start apache2 on Solaris10. It seems it needs to be started as a service. #svcadm -v enable -s apache2 Cheers ~Ram

Posted by Ram on September 21, 2005 at 01:18 AM IST #

Hi, I think I'm having same problem. I developed a website using the mambo content management system, basically a php/mysql/apache website deployment. I migrated this to a SUn Solaris 10 Server and so far the website is down citing lack of mysql support. I noticed my Linux box has the mysql_connect() script but not in the Sun Solaris server. I have a feeling this is causing my troubles and would appreciate some help on getting an app similar to the php-mysql app I have in my linux box. Thanks.

Posted by Charles Kibue on February 28, 2007 at 09:01 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

fintanr

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today