PHP DevCenter

oreilly.comSafari Books Online.Conferences.

We've expanded our LAMP news coverage and improved our search! Search for all things LAMP across O'Reilly!

Search
Search Tips

advertisement

Listen Print Discuss Subscribe to PHP Subscribe to Newsletters

PHP 4.3 and Mac OS X
Pages: 1, 2

In addition to configuring PHP to support additional extensions, you also need to tell PHP where to install its files. Apple stores files in a different set of directories than PHP's preferred location. However, you can instruct PHP to override its default settings to conform with Apple's.



To do this, pass in these four settings:

--prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man

Once you set up PHP to install files correctly, add your Web server into the mix. If you don't specifically tell PHP your Web server, PHP builds a generic CGI version. But, if you're running Apache, for instance, PHP can create an Apache module. Apache 1.x support is added by passing in --with-apxs.

--with-apxs

If you're running Apple's bundled Apache, PHP automatically locates your server and properly configures itself accordingly. (This will probably work even if you've reinstalled Apache.)

Other Web servers have different commands. The experimental PHP Apache 2.x filer is built with --apxs2. For others, run the help command, as mentioned earlier. It shows a list of Web server options.

One final configuration note. PHP does not install zlib automatically, and without zlib, MySQL and other programs won't run. So, explicitly add this extension to your configuration line:

--with-zlib

Putting all this together gives us these parameters for a basic Apache and PHP installation:

[benlev:~/php-4.3.0] adam% ./configure --prefix=/usr --sysconfdir=/etc 
 --localstatedir=/var --mandir=/usr/share/man --with-apxs --with-zlib

Hit return and configure will run for a while, printing out a series of scrolling lines, before finally ending with this message:

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
|                          *** NOTE ***                              |
|            The default for register_globals is now OFF!            |
|                                                                    |
| If your application relies on register_globals being ON, you       |
| should explicitly set it to on in your php.ini file.               |
| Note that you are strongly encouraged to read                      |
| http://www.php.net/manual/en/security.registerglobals.php          |
| about the implications of having register_globals set to on, and   |
| avoid using it if possible.                                        |
+--------------------------------------------------------------------+

Thank you for using PHP.

As you see, PHP now disables the register_globals configuration directive. This change is effective as of PHP 4.2, but if you're upgrading directly from Apple's installed version (4.0.6), this is the first time the change affects you. In brief, you can no longer access a HTML form variable called "name" as $name. Instead, you need to check the value of $_GET['name'] or $_POST['name']. See the online PHP manual for additional information.

If you don't see this message, PHP had a problem during configuration. Look at the error message and fix what's broken. If you cannot solve the problem by yourself, check the Installation PHP mailing list for help.

Now that the laborious configuration process is complete, compile PHP by running make:

[benlev:~/php-4.3.0] adam% make

This will take a while. Don't be afraid if you see warnings. Warnings are okay; errors are not. There's no fancy announcement when this finishes, so unless you see an obvious error message, everything went OK when the printing stops.

Finally, you want to install PHP. This overwrites any pre-existing copies of PHP on your system. So, if you want to keep them (for testing purposes or nostalgia), now is the time to back them up. If you've chosen to use the directories suggested above, you need administrator privileges to install PHP, so run this command through sudo:

[benlev:~/php-4.3.0] adam% sudo make install

The installer places the Web server module in the correct place, installs the PHP command line version, and also places PEAR onto your system. (A few helper files are also installed.)

If you run Apache and PHP, restart your Web server to use your new copy of PHP:

[benlev:~/php-4.3.0] adam% sudo apachectl graceful

You can verify everything worked OK by viewing a page containing the output from phpinfo(). Check out the version number, build date, and configuration options to make sure.

However, if you're trying out PHP and Apache for the first time, see Kevin Hemenway's article on Apache and PHP to learn how to configure Apache to support PHP.

The command line interface to PHP (aka PHP CLI) lets you execute PHP scripts without the overhead of requesting them using a Web browser. Recently released versions of PHP had unofficial support for the CLI, but it has gone final with 4.3.0. If you want to use PHP for system maintenance tasks or with PHP-GTK, the CLI is for you. (Note: If you've chosen to install PHP as a CGI instead of a Web server module, then you need to explicitly install the CLI using make install-cli. This isn't a problem for people installing PHP as an Apache module, as described earlier in this article.)

Congratulations. You now have a working copy of PHP 4.3 on your Macintosh. Enjoy.


O'Reilly & Associates recently released (November 2002) PHP Cookbook .

  • Beta Sample Chapter 8, Web Basics, is available free online.

  • You can also look at the Full Description of the book.

  • For more information, or to order the book, click here.

Adam Trachtenberg is the manager of technical evangelism for eBay and is the author of two O'Reilly books, "Upgrading to PHP 5" and "PHP Cookbook." In February he will be speaking at Web Services Edge 2005 on "Developing E-Commerce Applications with Web Services" and at the O'Reilly booth at LinuxWorld on "Writing eBay Web Services Applications with PHP 5."


Return to the PHP DevCenter.


These instructions have been tested only under Mac OS X 10.2.3. If you have had success or difficulty with earlier versions, please tell us about it.
You must be logged in to the O'Reilly Network to post a talkback.
Post Comment
Full Threads Oldest First

Showing messages 1 through 99 of 99.

  • Problem getting php to recognize curl
    2006-04-11 01:07:20  billc108 [Reply | View]

    Hi all

    I've had pretty good success compiling php (4.4.2 on 10.3.9 most recently), but I'm having trouble getting curl to load properly. I've installed all the dependencies and have --with-cURL=/usr in the configure statement, and it still comes up with

    checking for CURL support... no

    any suggestions on what to look for? I'm running out of ideas.
  • Great resource!
    2005-10-30 08:36:43  Working_in_PJ [Reply | View]

    I really appreciate all these o'Reilly resources. Our small office web/email server is still running 10.2.8 client, and I've been wanting to update PHP from 4.3.10 to 4.3.11 since Apple seems to have stopped releasing security updates for 10.2.8. I followed the instruction from this article, and using the phpinfo() from my 10.3.9 machine as a guide, I was able to build and install 4.3.11 on my 10.2.8 without a hitch (at least everything seems to be working so far).

    Thanks for this wonderful resource.

  • PHP 4.3.10 on OS X 10.2.8
    2005-02-01 11:59:50  rmwiseman [Reply | View]

    I had PHP successfully built and then Apple's software update came in and destroyed my build, replacing it with another one with different options (and, importantly, curl disabled). I downloaded PHP 4.3.10 and used the configuration here, with --with-curl=/opt/src/curl-7.10.5 appended.

    However, this and any other configuration I've tried result in nasty errors when I do a make. It says about things like:

    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:239: parse error before "uint32_t"
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:239: warning: no semicolon at end of struct or union
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:240: warning: data definition has no type or storage class
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:386: parse error before "uint32_t"
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:386: warning: no semicolon at end of struct or union
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c: In function `Balloc':
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:405: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:409: sizeof applied to an incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:410: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:411: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:413: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:413: dereferencing pointer to incomplete type

    and then ends up with:

    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c: In function `zend_strtod':
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1243: parse error before "rv"
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1245: `uint32_t' undeclared (first use in this function)
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1245: parse error before "y"
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1252: `rv' undeclared (first use in this function)
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1277: `y' undeclared (first use in this function)
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1277: `z' undeclared (first use in this function)
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1485: `rv0' undeclared (first use in this function)
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1514: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1515: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1515: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1515: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1570: dereferencing pointer to incomplete type
    /Users/richard/Desktop/php-4.3.10/Zend/zend_strtod.c:1571: dereferencing pointer to incomplete type
    make: *** [Zend/zend_strtod.lo] Error 1

    I've always been a little afraid of using make so, any suggestions would be appreciated!
    Thanks in advance.
    Richard
    • PHP 4.3.10 on OS X 10.2.8
      2005-02-03 11:59:07  rmwiseman [Reply | View]

      I just tried 4.3.4 and then 4.3.9, and both of these installed without hitch using exactly the same commands as previously. Looks like there's something amiss with 4.3.10 on OS X 10.2.8.
  • missing commands in terminal
    2004-12-21 10:02:10  jamiekravitz [Reply | View]

    I have been trying to get my MOXAMP configuration to work on my PowerBook (OS 10.2.8). I updated MySQL but then the handshake with PHP 4.1.3 didn't work, so I'm trying to update to PHP 4.3.10, using the instructions included here.

    I got it to go through the configure process, and it got to the end ("Thank you for using PHP!") but I get lots of messages from Terminal indicating missing UNIX commands, like 'grep', 'egrep' (message: Command not found). I tried to read the debug.log file, but my Terminal doesn't even recognize 'pico'!

    I installed the Developer Tools for 10.2; are there other things I need to do to Terminal to get it to recognize these commands?
    • missing commands in terminal
      2005-01-17 18:00:30  nika_berlin [Reply | View]

      hi  jamiekravitz,


      PHP 4.3.10 is running only on Mac OS X 10.3!

      have a look:
      http://www.entropy.ch/software/macosx/php/

      ;-) nika
  • Compile Errors
    2004-02-29 05:08:12  samsprograms [Reply | View]

    I am having trouble compiling PHP. I am using my own built Apache 2.0 and OS 10.3. When i configured I did use apxs2 instead of apxs. I am getting this error consistently (after building many other files...):

    ld: warning multiple definitions of symbol _pcre_free
    ext/pcre/pcrelib/pcre.o definition of _pcre_free in section (__DATA,__data)
    /opt/apache2/bin/httpd definition of _pcre_free
    ld: warning multiple definitions of symbol _pcre_fullinfo
    ext/pcre/pcrelib/pcre.o definition of _pcre_fullinfo in section (__TEXT,__text)
    /opt/apache2/bin/httpd definition of _pcre_fullinfo
    ld: warning multiple definitions of symbol _pcre_malloc
    ext/pcre/pcrelib/pcre.o definition of _pcre_malloc in section (__DATA,__data)
    /opt/apache2/bin/httpd definition of _pcre_malloc
    ld: warning multiple definitions of symbol _regcomp
    /opt/apache2/bin/httpd definition of _regcomp
    /usr/lib/libm.dylib(regcomp.So) definition of _regcomp
    ld: warning multiple definitions of symbol _regexec
    /opt/apache2/bin/httpd definition of _regexec
    /usr/lib/libm.dylib(regexec.So) definition of _regexec
    ld: warning multiple definitions of symbol _regfree
    /opt/apache2/bin/httpd definition of _regfree
    /usr/lib/libm.dylib(regfree.So) definition of _regfree
    ld: Undefined symbols:
    _php_check_open_basedir_ex
    make: *** [libs/libphp4.bundle] Error 1


    Any ideas?
  • "./configure --with" does not seems to work
    2004-02-12 01:15:12  jeanloui [Reply | View]

    I have followed all the steps... and those in

    http://developer.apple.com/internet/macosx/php.html

    Downloaded php 4.3.4 (not from entropy, but the standard)
    Downloaded all the Fink stuff (great!)

    No errors during ./configure --with-xxx

    "make install" without the old php 4.1.2 backup (sorry)

    Restart the Apache and...

    When I go to info.php, the 4.3.4 is running but it does not recognize all the configure commands (only '--with-apxs')

    Its a strange situation, cause I'm running mysql and some php/mysql sites (PostNuke) work all right but some recent scripts stop to work...

    What can be happened?

    Does the "make install" create the php.ini (and place it at the appropiate dir) the or I must do something (re-place it) manually?

    I have placed the "php.ini-recommended" in usr/local/lib and renamed it php.ini

    I'm under Mac OS X 10.2.8 and mysql 2.3.2, Apache 1.3.29 (Darwin)

    Thanks!
    • some advances
      2004-02-12 05:50:31  jeanloui [Reply | View]

      I have "fixed" some of this with the "BAD" php.ini option of
      register_globals = On

      (I must upgrade my scripts :(
      -----
      But php.info still does not recognize the "--with-xxx" configures...

      He IS managing the mysql, but he does not run the gd graphic libraries (for instance)

      * Is there a way of forcing this ./configures whit declarations in php.ini ?

      * Must I ./configure --with-xxx (All libraries) again?

      * And every time that I ./configure , must I "make", "sudo make install" and change the php.ini ?? Or there is a short way for all that ??

      * Is there an istruction in ./configure for knowing internally WHAT libraries are enabled?

      You see: I still need the help!

      (and I'll post here if I fix it)

      Thanks!
      • Adam Trachtenberg photo some advances
        2004-04-07 22:14:33  Adam Trachtenberg | O'Reilly Author [Reply | View]

        You should do a: "make clean" before you reconfigure anything if you want phpinfo() to display the correct configuration options.

        After the configure, you must do a "make," "sudo make install," and "sudo apachectl restart." The configure command only tells PHP how it should be configured when you build it using make, it doesn't make the changes itself.

        You don't need to copy or edit php.ini.
        • upgrading to 4.3.6
          2004-05-07 05:10:59  jeanloui [Reply | View]

          I have cleaned all and upgraded to 4.3.6 and builded and istalled png, jpeg and xml libraries


          Now my Configure Command looks like this:
          './configure' '--with-xml' '--with-zlib' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-apxs=/usr/sbin/apxs'
          and I can "imagecreate" png files!


          - I'm still running well the mysql 3.23.49 although no "--with-dbase" nor "--with-msql" configure commands appear: How is it possible?

          Thanks for all your great support!

    • error logs
      2004-02-12 02:37:10  jeanloui [Reply | View]

      I get this kind of errors in error_log:

      [error] PHP Notice: Use of undefined constant
      [error] PHP Notice: Undefined variable:
      [error] PHP Notice: Use of undefined constant http_referer - assumed


      And all this constants and variables are defined !
      ------
      Also there are 3 strange new lines:

      Processing config directory: /private/etc/httpd/users
      Processing config file: /private/etc/httpd/users/prunila.conf
      Processing config file: /private/etc/httpd/users/xavierbl.conf


      * Why is Apache checking the users dirs?

      I only want to use one ! httpd.conf at
      private/etc/httpd/

      ... and the only good line:

      [notice] Apache/1.3.29 (Darwin) PHP/4.3.4 mod_perl/1.26 configured -- resuming normal operations
      • Adam Trachtenberg photo error logs
        2004-04-07 22:10:03  Adam Trachtenberg | O'Reilly Author [Reply | View]

        The "use of undefined constant" lines usually appear when you reference an array element inside double quotes.

        The Apache config lines are there to allow users to customize their personal home directories configuration without giving them access to the main httpd.conf file, which is owned by root. It's a feature, not a bug. I think you can disable this by editing out a few lines at the bottom of the master httpd.conf file, if it really bothers you.
  • adding directives in the future
    2004-01-27 07:40:42  nicki [Reply | View]

    This is a newbie question- I have everything working but just want php to look at curl. Does this mean I have to go through this entire process to add that. I mean, everytime I want php to see a new thing, I have to start from scratch like this? I was hoping there was a way to just run the configure command alone or add a line to php.in like you can do for windows. Although maybe the mac doesn't come with the build, just everything already working.
    Thanks,
    Nicki
    • Adam Trachtenberg photo adding directives in the future
      2004-01-29 18:04:06  Adam Trachtenberg | O'Reilly Author [Reply | View]

      If you've already built PHP on Mac OS X (instead of using Apple's built-in version) and didn't configure it to include cURL, you need to rebuild PHP. However, it shouldn't be too bad, there's a file named "config.cache" that saves your old configuration. I'd do:

      % ./config.nice --enable-curl
      % make
      % sudo make install

      And that should be everything you need. If you run into weird compile errors, do:

      % make clean

      And repeat the whole process. That'll clear out the old junk lying around from before.

      Also, if you want to use the curl installed using fink instead of Apple's, do:

      % ./config.nice --with-curl=/sw

      If you've never built PHP before, you do need to go through the entire process. There's no special trick to just add in one module, like cURL.
  • MySQL import and/or compiling problems
    2003-12-16 11:30:49  dmcole [Reply | View]

    Hiya. UNIX neophyte, so please be gentle.

    Downloaded and successfully implemented Entropy.ch PHP package.

    Get to the part where I want to import a file into a table in MySQL. Get the error message "The Used command is not allowed with this MySQL version."

    Look that up on the MySQL site and its suggested there (http://www.mysql.com/doc/en/LOAD_DATA_LOCAL.html) that if the version of PHP is compiled with the "--with-mysql=/usr" command rather than the traditional "--with-mysql" command, all will be well.

    I post a note on the Entropy board asking about this and whether Marc could/would make a new package that supported this command. The note is now two days old and no response.

    I go to the php.net site and get the source code for 4.3.4 and have been trying to compile it with all the same functions as the Entropy version.

    I've had to Fink a bunch of stuff over, but now I've hit a problem that I can't seem to solve. From this compilation command (http://www.colegroup.com/php-configure.html), I get the error message "FreeType2 not found!" Of course, it's there (Fink tells me so).

    So, here are my two questions:

    *Am I headed in the right direction to fix the MySQL problem?

    *In what order should the FreeType and FreeType2 with commands be set to get this to compile?

    Thanks.
    • Solution to FreeType2 not found!
      2004-01-16 19:23:38  anonymous2 [Reply | View]

      I had the same problem. This can be solved by not using the Fink package but download and compile FreeType2 by yourself. Then you need to configure with option:

      'with-freetype-dir=/usr/local'
      • Adam Trachtenberg photo Solution to FreeType2 not found!
        2004-01-29 18:59:07  Adam Trachtenberg | O'Reilly Author [Reply | View]

        If you want to use fink, you need to do:

        --with-freetype-dir=/sw/lib/freetype2

        Alternatively, if you installed Apple's X11 system, try:

        --with-freetype-dir=/usr/X11R6
  • Are these instructions compatible with OS X 10.3 Panther?
    2003-11-02 10:05:17  anonymous2 [Reply | View]

    I know that OS X 10.3 Panther has PHP 4.3.2, but it is still missing the GD libraries necessary for the image functions.

    Has anyone used these instructions under Panther? ...and successfully included the GD lib?
    • Are these instructions compatible with OS X 10.3 Panther?
      2003-11-27 15:46:46  anonymous2 [Reply | View]

      Same thing here. It's great that Apple included PHP with 10.3 but I need modules that aren't included so I must recompile.

      What will these instruction do to the current default php install? Overwrite it? Make a new one somewhere else and I need to change my httpd.conf file afterwards to use the new php module?
      • Adam Trachtenberg photo Are these instructions compatible with OS X 10.3 Panther?
        2003-12-02 21:30:54  Adam Trachtenberg | O'Reilly Author [Reply | View]

        I believe these should still work with 10.3. I build development version of PHP 5 on a daily basis and yesterday I built a snapshot of PHP 4.

        If you run into problems, post a message.

        I overwrote my Apple's version of PHP with my custom built one. You can back up the old versions first if you're worried about problems.
  • Succesfull install.
    2003-09-08 11:18:13  anonymous2 [Reply | View]

    Thanks for all, i've succesfully compiled php 4.3.3. on os X.2.6.
    I'll enjoy now ;-)
  • Zend Optimizer installed
    2003-08-24 13:43:02  anonymous2 [Reply | View]

    I managed to get Zend Optimizer 2.1.0b working:
    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies with Zend Optimizer v2.1.0,
    Copyright (c) 1998-2003, by Zend Technologies


    using the following in php.ini:

    zend_optimizer.optimization_level=15
    zend_extension="/usr/lib/php/ZendOptimizer.so"
    zend_optimizer.enable_loader=0
  • error during make
    2003-07-02 15:18:59  anonymous2 [Reply | View]


    installing php 4.3.2 on 10.2.6 I had the following error during make:
    ld: can't create output file: libs/libphp4.bundle (Permission denied, errno = 13)

    I reran make using "sudo make" and it went fine.
  • Error during make
    2003-06-24 15:08:40  anonymous2 [Reply | View]

    This is my first time trying to install from source rather than binaries, as prompted by this article. My configure command finally works fine :

    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --with-apxs --with-mysql --enable-ftp

    but when I try "make", I get an error after a few hundred lines:
    ~/desktop/php-4.3.2/ext/ctype/ctype.c:74: (near initialization for `ctype_module_entry.handle')
    make: *** [ext/ctype/ctype.lo] Error 1

    Any clues at all? I'd love to get this working so I don't have to rely on binaries anymore (not that they haven't been great, Marc!)
  • Files with php3 extensions will not execute.
    2003-06-10 08:29:09  anonymous2 [Reply | View]

    Files with php extensions work correctly, files with php3 extentions will not work. I am running php4.1.2 and Apache 1.3.27 on Mac OS X.

    Is the problem that php4 doesnt recognise the php3 extension?

    I have added following line to the htttpd.conf file

    #######################

    # For example, the PHP 3.x module will typically use:
    #
    AddType application/x-httpd-php3 .php3
    AddType application/x-httpd-php3-source .phps
    #
    # And for PHP 4.x, use:
    #
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps


    ############################

    • Adam Trachtenberg photo Files with php3 extensions will not execute.
      2003-06-10 09:17:13  Adam Trachtenberg | O'Reilly Author [Reply | View]

      I'm not 100% positive what you want to happen, so I'll give you two answers and hope one of them hits its mark.

      If you want files ending in .php3 to be parsed by PHP 4.1.2 (and therefore treated as PHP 4 files), you should change the top two lines to this new one line:

      AddType application/x-httpd-php .php3

      And then restart Apache by entering "sudo apachectl restart" in Terminal.

      Right now, Apache is trying to run these files under PHP 3, which isn't installed.

      This is what I think you want. There is also a smaller chance that you actually want PHP 3 to execute these files. It seems unlikely because PHP 3 is very old and obsolete. If that's so, however, you're out of luck. You cannot run PHP 3 on your Macintosh. You should consider porting the files to PHP 4. See http://us4.php.net/manual/en/migration4.php for more details.
  • error: no acceptable cc found in $PATH
    2003-05-28 15:43:02  anonymous2 [Reply | View]

    I followed the instructions in article. The results I got below ended with an error at checking for cc, I could find no reference to this anywhere. Any ideas?

    ./configure --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --with-apxs --with-zlib
    loading cache ./config.cache
    checking for Cygwin environment... no
    checking for mingw32 environment... no
    checking for working sed... sed
    checking host system type... powerpc-apple-darwin6.6
    checking for gcc... no
    checking for cc... no
    configure: error: no acceptable cc found in $PATH
    • Adam Trachtenberg photo error: no acceptable cc found in $PATH
      2003-05-29 20:23:52  Adam Trachtenberg | O'Reilly Author [Reply | View]

      It looks as if you haven't installed the Developer Tools. Or, at the very least, you didn't install a C compiler, like gcc. (GNU C Compiler.)

      If you have, type "echo $PATH" on the command line and show me the output.
  • Error During 'sudo make install'
    2003-05-23 19:54:49  anonymous2 [Reply | View]

    Here is my config:

    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --with-apxs --with-zlib --with-curl=/sw --with-dom=/sw --enable-xlst --with-dom-xlst=/sw --with-pear --with-mysql --with-ldap=/sw

    Which configured fine once I added the right libraries using Fink (FinkCommander).

    make proceeded without any problems, but when doing make install, I get the following error about 10 sec. in:

    grep: /sw/lib/libsasl2.la: No such file or directory
    sed: /sw/lib/libsasl2.la: No such file or directory
    libtool: link: `/sw/lib/libsasl2.la' is not a valid libtool archive
    make: *** [libphp4.la] Error 1


    Any suggestions? Recommendations?

    Thanks.


    • Adam Trachtenberg photo Error During 'sudo make install'
      2003-05-29 20:30:27  Adam Trachtenberg | O'Reilly Author [Reply | View]

      Have you tried installing the cyrus-sasl2-dev and cyrus-sasl2-shlib packages from fink?

      This is somehow related to your LDAP configuration, but I haven't run across this error before, so I'm not positive what you need to do.
  • Great article...but my old build is still serving pages
    2003-05-20 05:16:20  anonymous2 [Reply | View]

    I really appreciate this article, and I've used it several times in the past to get PHP builds running on my machine. I've just built it again, however, to get the PDFlib working, and I've found that phpinfo() shows my old build date with my old configure command.

    I'm running OS 10.2.6 (maybe that's part of it?). My /usr/libexec/httpd/libphp4.so file *is* the new build--the date on the file is today. There aren't any errors that I can see in my Apache error log. (There is a line that reads "Accept mutex: flock (Default: flock)" but that doesn't seem like an error, does it?)

    The httpd.conf file is normal; php is on. It's serving pages, all right...but as I say it's the old build, not the new one. I haven't tried rebooting yet, but I don't recall having to reboot in the past when I've built PHP.

    As an extra data point, I don't have the command line version of PHP at /usr/bin/php, for whatever reason.

    Any ideas, anyone?
    • Update--still the same after reboot
      2003-05-20 05:30:28  anonymous2 [Reply | View]

      OK, so I just rebooted, and...the old build's still the one Apache is using. This is really strange, as your instructions have worked just fine in the past.
      • Sigh. Never mind
        2003-05-20 08:12:04  anonymous2 [Reply | View]

        Downloading the source again fixed it. Duh. Now if I can only get the pdflib working...
        • Adam Trachtenberg photo Sigh. Never mind
          2003-05-20 11:38:18  Adam Trachtenberg | O'Reilly Author [Reply | View]

          Glad everything worked out okay.

          I have never tried building the PDFLib on Mac OS. Are you getting compile errors or what? Maybe I can help debug or try it on my machine and see what happens. (I'm up to 10.2.6 myself, so we should be in sync.)
          • Adam Trachtenberg photo Sigh. Never mind
            2003-05-29 20:32:23  Adam Trachtenberg | O'Reilly Author [Reply | View]

            I tried getting this working by hacking up some files to add some Mac OS X specific flags, but in removing certain problems I have introduced others. If you're still banging away on this, reply and I will try again; otherwise, I'm not going to play with this anymore right now.
            • PDFlib, pdflib.upr
              2003-05-30 10:37:59  anonymous2 [Reply | View]

              Thanks for looking into it. I actually *did* get PDFlib working--I needed to install the PDF, TIFF, JPG, and PDF shared libraries through Fink. Of course, I immediately ran into a brick wall with configuring the pdflib.upr file to find my fonts. There's actually very, very little info out there about getting pdflib.upr to function on OS X. Any suggestions you might have on that would be helpful, but I suspect that we're way, way off-topic now.
  • Problems compiling Php4.3.1 with java on Mac OsX
    2003-05-07 10:44:46  anonymous2 [Reply | View]

    First I configure Php with:
    ./configure --with-apxs --with-java=/Library/Java/Home
    everything is OK, so I try to compile Php with
    make
    but I obtain many errors and warning messages about java components, like "jni.h: No such file or Directory", "parse errer before JavaVM", and many others. The Last is "Error 1".
    I use Mac Os X 10.2.5 with yhe latest realease of Java 2 Platform, Standard Edition, version 1.4.1
    Can help me, please?
    • Problems compiling Php4.3.1 with java on Mac OsX
      2004-04-07 18:04:14  jamfan [Reply | View]

      Just curious if anyone had figured out a solution to this problem with jni.h. I'm using 10.3.3 with Java 1.4.2.

      Thanks,
      • Problems compiling Php4.3.1 with java on Mac OsX
        2004-04-08 02:04:34  jamfan [Reply | View]

        Whoops... ignore my previous post. I seem to have missed the reply concerning downloading the newest release from the apple developer support site -- that seemed to fix the compilation problem, though i'm now having problems with a java.lang.UnsatisfiedLinkError whenever I try creating a basic Java object from PHP (instantiating a new java.lang.System object).
    • Problems compiling Php4.3.1 with java on Mac OsX
      2004-03-03 16:39:58  daveola [Reply | View]


      Make sure you've installed the latest Java Developer Package from developer.apple.com, otherwise you'll be missing needed java headers.

      Dave
      http://GetDave.com/
      http://MarginalHacks.com/
    • Problems compiling Php4.3.1 with java on Mac OsX
      2003-10-08 19:14:50  anonymous2 [Reply | View]

      I'm running into the same problem with a different compile, Open Office. I don't know if this will help but jni.h exists in Java 1.3.1 but not in 1.4.1 in their respective headers directories.

      You might want to check your java version and arrange for jni.h to be found.
    • Adam Trachtenberg photo Problems compiling Php4.3.1 with java on Mac OsX
      2003-05-12 22:17:11  Adam Trachtenberg | O'Reilly Author [Reply | View]

      I have a lot of problems getting Java to work with PHP, even when running Linux. The Java extension is not very actively maintained, so I'm not surprised that you're having difficulties. I don't even know if 1.4.1 works with PHP at all, unfortunately. Sorry I can't be more help here, maybe someone else can provide assistance.

      -adam
  • Zend Optimizer
    2003-04-22 16:40:39  anonymous2 [Reply | View]

    Has any one managed to get the Zend Optimizer for OS X to work with 4.3 ? It is free to download, and would speed up my iBook a bit.

    Will
    • Adam Trachtenberg photo Zend Optimizer
      2003-04-22 18:07:22  Adam Trachtenberg | O'Reilly Author [Reply | View]

      I just checked out the Zend.com site. They have a version of Zend Optimizer (2.0.3) for Mac OS X that works with PHP 4.1, but they haven't yet released a version (2.1) that works with PHP 4.3. Zend Optimizer 2.1 is already available for Linux, Windows, and Solaris, so I have no idea why the Mac OS X version is lagging along.

      Unfortunately, since the Zend Optimizer is closed source software, I can't produce an updated version fo Mac OS X and I'm 99.94% positive none of the other versions will work on a Mac.

      I'm sorry to say, but I think the best way to find out when this is coming is to contact Zend directly. (http://www.zend.com/store/contact.php) Hopefully they can provide an answer.

      Thanks.

      -adam
  • Instalation
    2003-03-14 06:18:35  anonymous2 [Reply | View]

    Hi
    Very well written and easy to follow. A newbe like me had no problems. Well, exept this line
    [benlev:~/php-4.3.0] adam% make

    It took me a bit of time to find out that it should be that
    [benlev:~/php-4.3.0] adam% sudo make
    after that it went fine.

    I found in my Library file a folder "PHP4", now I am not sure if I can remove this one or not. So where is PHP 4.3.0 stored. Does it show up in any Library listing?

    If I do not need this "PHP4" folder I like to trash it.

    thank for the good instructions.

    Jens
    • Adam Trachtenberg photo Instalation
      2003-04-22 17:49:18  Adam Trachtenberg | O'Reilly Author [Reply | View]

      Hi Jens!

      I don't have a folder named "PHP4" in my Library, so I think you can probably delete this. The new version of PHP, 4.3.0, should be located in two places. The Apache module version is (most likely) in /usr/libexec/httpd/libphp4.so, while the command line version is at /usr/bin/php.

      Whether you need to run "make" or "sudo make" depends upon the permission settings of your files and what username you're using when you run this command. For my setup, "make" is enough; for others, I guess, you need to use "sudo." Nice catch!

      Thanks.

      -adam
  • These instructions don't seem to work
    2003-02-16 23:28:52  anonymous2 [Reply | View]

    Did anyone get these instructions, or anything like them, to actually work .... what I see here is lots of questions, and few - if any - answers. It can't find zlib, but the instructions say its required (its not on fink either) and also even if you install gd-bin from fink the configure can't find it... these kind of questions are asked below, but with no answers.

    it seems better to go to www.entropy.ch/software/macosx/php and get it from there, it seems to have to most usual set of extensions (including GD - which is the main reason I want to upgrade).

    - Mitra
    • These instructions don't - But I got it
      2003-03-25 12:18:45  anonymous2 [Reply | View]

      I had the same problem.

      So I read an article on PHPmac.com, but before re-doing everything I just tried this:

      If you have not used PHP on your Mac before:
      Open the Apache Configuration file (/etc/httpd/httpd.conf) in your favourite Text Editor (In these examples I have used Pico)
      % sudo pico /etc/httpd/httpd.conf

      Now add these lines to the very bottom of the file:
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps

      Now save and quit by pressing Control-O, Overwrite the old file (hit Enter) and then press Control-X to exit Pico.

      Restart Apache:
      % sudo apachectl restart

      If you have any questions etc. please check below, or email support@phpmac.com

      -James


      That worked for me.

      For the complete article goto http://www.phpmac.com/articles/view.php?id=117
    • These instructions don't seem to work
      2003-02-28 21:06:42  tychay [Reply | View]

      Adam is not quite right when he says "without zlib, MySQL and other programs won't run", without zlib, PHP 4.3 MySQL can't take advantage of compression (a feature that is very rarely used and turned off by default in phpMyAdmin).

      Also, the correct line to enable it for MySQL "and other programs" is
      --with-zlib-dir=/usr

      I'm not too sure why it can't find zlib. zlib comes by default with Mac OS X and developer tools should install the proper headers:

      bash-2.05a$ locate libz
      ...some other stuff...
      /usr/lib/libz.1.1.3.dylib
      /usr/lib/libz.1.dylib
      /usr/lib/libz.dylib

      Why not try '--with-zlib=/usr' which should be redundant unless you've f-d up your library and include paths.

      If a header file is missing, then check to see of /usr/include/zlib.h is on your system. If not, install Developer Tools.

      Installing gd-bin from fink doesn't do squat because it's not the library or the headers. Besides, you should be using gd2, not gd. Try installing "gd2", "gd2-bin", and "gd2-shlibs" (why there is no "gd-devel" I don't know). Better yet, build just the libpng3*, libjpeg*, freetype2* packages and then use the version of gd2 that came with PHP 4.3 (it has better support for alpha channels as well as can load GIFs).

      As for why compile it yourself. I see five reasons
      1) Mark installed something that you don't need. Because lack of dynamic loading of extensions in Mac OS X, your binary is bigger than it needs to be.
      2) Mark didn't install something you need (for the especially masochistic, try building php-gtk).
      3) Mark doesn't have the latest version or there is a patch in CVS for a bug.
      4) You want to use the PHP command line interface or need PEAR.
      5) You want to install PHP 5
      In the future there will be"
      6) You want to compile PHP5 with dynamic loading of extensions.

      If those aren't an issue, use a precompiled binary froma trusted source. That's the mac way, anyway.

      Take care,

      terry chay
      tychay at php dot net
  • Features List ?
    2003-02-11 17:23:40  anonymous2 [Reply | View]

    Where can I find a comprehensive list of the options available for enabling during install? The list on php.net (http://www.php.net/manual/en/install.configure.php) does not include many of those mentioned in the article (--enable-ftp, jpg, gif, etc).
    • Features List ?
      2003-02-28 20:07:59  tychay [Reply | View]

      As mentioned by Adam i the article, try:
      ./configure --help

      There is no "complete" list since you can unpack any PHP extension into the ext/* directory and do a ./buildconf before the ./configure. (Note ./buildconf nowadays might require a later version of autoconf, automake or libtool than Apple provides), but that is a start.

      Usually, if there is something missing from the ./configure --help that is documented elsewhere, that feature was removed. (This is not always the case though).

      Take care,

      terry chay
      tychay at php dot net
  • error on installation
    2003-02-09 15:05:22  anonymous2 [Reply | View]

    Hello Everyone

    Im new to this forum and new to PHP, so please bare with me if ask very basic and elementary questions. So here's my problem : im running a G4 Apple Macintosh w/ Jaguar 10.2.3 and I'm trying to do a basic installation of PHP 4.3.0. Here's what my terminal is saying after i do the basic command lines for the installation.(error in red)

    cd php-4.3.0
    moedee% ./configure --with-apxs
    loading cache ./config.cache
    checking for Cygwin environment... no
    checking for mingw32 environment... no
    checking for working sed... sed
    checking host system type... powerpc-apple-darwin6.3
    checking for gcc... no
    checking for cc... no
    configure: error: no acceptable cc found in $PATH

    Does anyone know what i need to do here? I've tried to find answers online to this error but with no success.
    • Developer Tools
      2003-02-09 19:20:01  ayakotan [Reply | View]

      Have you installed Apple Developer Tools on your mac? I had the same problem but after I installed Developer Tools I didn't get the error message.
  • Cannot update to 4.3 --please help!
    2003-02-08 21:00:40  anonymous2 [Reply | View]

    I am new to PHP and everything but I activated PHP4.2.3 and it was working fine. However, when I tried to use PHPmyAdmin, it says 4.2.3 has bugs to support multi byte strings. So I tried to install PHP 4.3.0 and followed the instruction, and it seems like it was successfuly installed, but when I check the version it is still 4.2.3 that's running?
    What can I do to make 4.3 run on my mac?
    • Cannot update to 4.3 --please help!
      2003-02-09 19:18:47  ayakotan [Reply | View]

      I just figured out myself...
      There is a package to install Apache and PHP4.3 at www.phpmac.com. I had to disable Apple default PHP module.
      --------------------------------------------------------------------
      If you have only used the PHP that came with OS X before:
      Comment (place a # at the start of the line) the following lines in your Apache Configuration (/etc/httpd/httpd.conf) file:
        LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
      AddModule mod_hfs_apple.c
  • Having problems with LDAP
    2003-02-04 08:22:35  qperkins [Reply | View]

    Since 10.2 was released, I have been able to use the built-in OpenLDAP libraries when I have built PHP 4.2x with just a --with-ldap flag.

    I am trying to build 4.3 for the first time with the following config line:
    ./configure --with-apxs --with-ldap --with-zlib --with-gd --enable-ftp --with-jpeg-dir=/sw --with-tiff-dir=/sw --with-pdflib=/sw --with-png-dir=/sw --with-mysql --with-freetype-dir=/sw --enable-sockets --with-xml --enable-ftp

    As you can see from my /sw directory, I am using Fink's libraries for the graphic pieces,but the problem is with LDAP. I am getting the following error:
    checking for LDAP support... yes
    configure: error: Cannot find ldap libraries in /usr/lib.

    I am using a 4.2.3 build of PHP on the same server with LDAP with no problem. Anyone have any ideas?

    Quinn Perkins

    • Having problems with LDAP
      2003-02-24 14:58:35  qperkins [Reply | View]

      In case someone else has this problem, this solution is to replace all references to libldap.so.3 with libldap.dylib in the config script.

      And I thought 4.3 was supposed to be ready for OS X...
      • Having problems with LDAP
        2003-02-28 20:37:42  tychay [Reply | View]

        Nice catch!

        The problem is not with the main of php but with ext/ldap/config.m4. The line should be changed from
        "libldap.so.3" to "libldap.$SHLIB_SUFFIX_NAME.3"

        Also, I'll do you one better. ;-) You probably want to change
        liblber.so to liblber.$SHLIB_SUFFIX_NAME since the test you pointed to occurs if it can't find the former.

        I posted the patch at
        http://bugs.php.net/bug.php?id=22485
        Please vote for it :-)

        BTW, Mac OS X Jaguar has a version of LDAP (used to replace the old NetInfo manager). So you don't really need fink for this...
        if you apply the patch above, you can then do
        ./buildconf
        ./configure --with-ldap=/usr

        :-)

        Take care,

        terry chay
        tychay at php dot net
  • mysql
    2003-01-29 20:09:39  anonymous2 [Reply | View]

    I am trying to get this to work with mysql from fink, so I am using:
    --with-mysql=/sw

    but I keep getting thihs error:
    configure: error: Cannot find header files under /sw

    any ideas here? I have the latest mysql installed by fink
    • mysql
      2003-02-28 19:42:53  tychay [Reply | View]

      You probably need the following packages
      "mysql-dev"
      and
      "mysql-shlibs"

      It sounds to me like the former is not installed.

      "mysql" is the server (aka MySQL) and "mysql-client" is the command line interface (aka mysql), which are probably not needed. Make sure the above two are definitely "current" and not "archived".

      Caveat emptor: I do not compile mysql against the Fink distribution so I could be wrong here.

      Take care,

      terry chay
      tychay at php dot net
  • macosx precompiled binaries
    2003-01-28 20:54:34  anonymous2 [Reply | View]

    If you give up building this (give it some more time, it'll eventually work and this is a great learning experience!) but if you decide to give up and go with precompiled binaries, here are a couple places to get them:

    4.3.0:
    http://blog.bitflux.ch/c6.html

    4.2.3:
    http://www.entropy.ch/software/macosx/php/

    The entropy site should have 4.3.0 eventually as the maintainer is on vacation as I write this.

    Regards,
    Philip
  • --with-zlib fails to find libz, any corrected instructions known?
    2003-01-28 18:50:06  anonymous2 [Reply | View]

    Trying to configure with --with-zlib fails, it reports "cannot find libz".

    I'm running a pretty standard, and updated OSX, with Fink installed. Fink doesn't appear to have zlib or libz, but I see there are files /usr/lib/libz.dylib (and libz.1.dylib and libz.1.1.3.dylib) so I've tried --with-zlib=/usr and --with-zlib=/usr/lib neither of which worked.

    - Mitra
    • --with-zlib fails to find libz, any corrected instructions known?
      2003-02-28 19:43:17  tychay [Reply | View]

      I tried php 4.3.1 distribution with the simple line
      ./configure --with-zlib=/usr
      and it worked fine.

      One thing is where is configure failing. Is it failing here?
      checking for ZLIB support... yes
      checking if the location of ZLIB install directory is defined... yes
      checking for gzgets in -lz... yes

      or is it failing in some other extension? A lot of extensions (domxml, mysql, pdflib, cpdf, etc.) expect zlib. To help it along....

      "--with-zlib=/usr --with-zlib-dir=/usr"

      assuming you have a compatible version of Developer Tools installed (the headers for libz come with it).

      I hope this helps,

      terry chay
      tychay at php dot net
  • php set-up problem
    2003-01-24 07:21:57  anonymous2 [Reply | View]

    the "--prefix=/usr" returns a command not found response when I attemp to execute the following "--prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man". How do I get this to work? Also, I downloaded "Fink" to update xml and ldap resources. I don't think I was successful the command line returned that it could not locate "gd.h" anywhere in /sw/ . How do I install the proper "ldap" and "libxml" resources?
    • Adam Trachtenberg photo php set-up problem
      2003-01-24 14:54:08  Adam Trachtenberg | O'Reilly Author [Reply | View]

      Okay, you seem to have a pair of problems.

      First, --prefix=/usr and so forth aren't commands to be executed directly. That's why you're getting the error. Instead, these are configuration directions (parameters) for the configuration program.

      So, the line from the article you need to mimic is:

      [benlev:~/php-4.3.0] adam% ./configure --prefix=/usr --sysconfdir=/etc
      --localstatedir=/var --mandir=/usr/share/man --with-apxs --with-zlib

      As you see, we prefix those params with "./configure", cause we're calling the configure program.

      Second, there's the issue of not being able to use LDAP and libXML. This is so new, it's hard for me to guess your exact problem. I do know "gd.h" is not a file for either of these extensions, but for the GD extension -- you should only see this if you pass in --with-gd. Try reading the earlier postings on this board and see if that helps solve the GD problem and you can get everything to work.
  • CURL version stops installl
    2003-01-23 09:19:31  anonymous2 [Reply | View]

    When entering the configure line I get the error:

    checking for CURL support... yes
    checking for CURL in default path... found in /usr
    checking for cURL 7.9.8 or greater... configure: error: cURL version 7.9.8 or later is required to compile php with cURL support

    I have installed a newer version of CURL using Fink, my path is loading Fink commands properly:

    [MyWorkstation:~] mc% echo $PATH
    /sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
    [MyWorkstation:~] mc% curl --version
    curl 7.10 (powerpc-apple-darwin6.3) libcurl/7.10 ipv6 zlib/1.1.3

    So Curl is greater than version 7.9.8.

    I have added the following option to the ./configure command:

    --with-curl=/sw

    any help here?

    • Adam Trachtenberg photo CURL version stops installl
      2003-01-24 14:45:49  Adam Trachtenberg | O'Reilly Author [Reply | View]

      Yes. First, the decision to use --with-curl=/sw is the correct one. Since fink doesn't delete files, the (old) Apple installed curl in /usr/bin still lives on your machine and the PHP configuration program is picking it up instead of the (new) fink version. (The configuration process and $PATH are independent of each other.)

      So, you need to manually add the /sw directory to point PHP and cURL 7.10. Once I did that, I got an error that essentially boiled down to "can't locate file for: -ldl" I did some poking around and the short answer is: I didn't have a necessary library installed.

      Using fink to install "dlcompat-dev" fixed the problem. (I already had dlcompat and dlcompat-shlibs installed.) Once I did that, PHP compiled with cURL just fine. (Well, it did give a warning about /lib not being found, but that's harmless.)

      Let me know if this fixes your problem or if you're still stuck.
      • CURL version stops installl
        2003-01-31 07:48:29  mcollins@kuwago.com [Reply | View]

        Thanks for taking a moment to consider my problem and offer advice. I followed your suggestion and used fink to install dlcompat-dev (the other two mentioned, dlcompat and dlcompat-shlibs, were also already installed by fink).

        I still get the following error when I issue the ./configure command:

        ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --with-apxs=/usr/sbin/apxs --with-curl=/sw
        ...etc

        checking for cURL 7.9.8 or greater... configure: error: cURL version 7.9.8 or later is required to compile php with cURL support

        I have also tried taking ou the option --prefix=/usr. Any other suggestions?
        • CURL version stops install
          2003-02-28 19:29:40  tychay [Reply | View]

          You could try installing over Apple's curl binaries (this is what I do). I gave instructions in a post below.

          The line:
          checking for CURL in default path... found in /usr
          occurs when the ./configure has "--with-curl" or "--with-curl=shared" (latter is unsported on Mac OS X). instead of "--with-curl=/sw". Thus, that line should not be output if youy have "--with-curl=/sw".

          Note:
          --prefix=/usr
          is only for targeting the make install. It shouldn't affect the configure

          The version of curl I install against is 7.10.3 from fink. I am using "curl-ssl", "curl-ssl-dev", and "curl-ssl-shlibs" packages. You definitely need either the "curl-dev" or "curl-ssl-dev", and the library is in "curl-shlibs" or "curl-ssl-shlibs" so you'll need that too. I don't think the "curl" or "curl-ssl" is needed, but it doesn't hurt to have it also.

          Unfortunately, I also smash Apple's installation of curl on my machines with my own, so I can't be 100% sure that PHP isn't accidentally linking against that.

          I hope this helps,

          terry chay
          tychay at php dot net
  • Installation ?
    2003-01-22 19:22:21  anonymous2 [Reply | View]

    Okay, I followed the instructions in the article and everything worked as expected. But why does my old 4.2.3 build keep showing up in my info window? How do I activate the new version? I restarted apache. No change.
    • Installation ?
      2003-02-28 19:12:19  tychay [Reply | View]

      Perhaps you have a 3rd party Apache installed as your webserver, or you had a 3rd party Apache installed somewhere in your path that apxs is finding.

      If you have a 3rd party apache installed, try changing the configure to
      --with-apxs=<path to apxs>
      or if it is an Apache 2 compile
      --with-apxs2=<path to apxs2>
      where <path to apxs(2)> is the path to the 3rd party apache.

      When you make install, php should replace the apxs module that used to be there.

      If you had some apxs that it is using (the wrong one), you can force it to use the Mac OS X bundled one with
      --with-apxs=/usr/sbin/apxs

      Take care,

      terry chay
      tychay at php dot net
    • Adam Trachtenberg photo Installation ?
      2003-01-23 08:04:20  Adam Trachtenberg | O'Reilly Author [Reply | View]

      Hum... Restarting Apache should cause it to load 4.3 and dump 4.2.3. By "info window," I'm guessing you mean the output from phpinfo()?

      Can you run "php -v" and make sure it reports 4.3 as the version number? If not, maybe something didn't work correctly for the install. This checks the CLI and not the Apache module, but if the CLI didn't get installed, then this would be an indication of a bigger (non-Apache specific) issue.

      Also, try checking the Apache error_log to see if it reported an error message.
  • Location of fink packages
    2003-01-21 12:55:35  anonymous2 [Reply | View]

    The article mentions:

    " if your package manager places its files in a special location, tell PHP where to find them by placing an equal sign and the path after the command name:

    --with-gd=/sw

    This lets PHP find the GD graphics library in the /sw directory, which is where fink places files."

    However isn't the location of files in /sw/bin?

    For example, I updated curl to the latest version (as required by PHP 4.3.0) and now CURL is located at /sw/bin/curl. So, shouldn't the configure option be:

    --with-curl=/sw/bin

    • Adam Trachtenberg photo Location of fink packages
      2003-01-21 13:56:11  Adam Trachtenberg | O'Reilly Author [Reply | View]

      You'll only find the cURL application in /sw/bin/. (Well, also curl-config.) However, PHP uses other cURL files. They're installed by fink in /sw/lib, /sw/include, and other locations off of the /sw root.

      It's possible that PHP will work correctly if you pass in /sw/bin, but I still think you're better off using /sw. (I'd need to update my verion of cURL to test this.) But, if you're used to Linux, it's just like entering /usr/local.

      -adam
      • Location of fink packages
        2003-02-28 19:04:15  tychay [Reply | View]

        It should be noted that the default version of curl in Jaguar is 7.7.? but PHP 4.3 "--with-curl" requires curl 7.8.2 (some docs say 7.9) or later so you need to compile curl yourself (not much of a stretch), or use Fink's curl package.

        If you compile curl yourself and want to write over Apple's installation, use
        curl --remote-name http://curl.hax.se/download/curl-7.10.3.tar.bz2
        bzip2 -dc curl-7.10.3.tar.bz2 | gnutar --extract
        pushd curl-7.10.3
        ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-static --enable-shared --with-ssl=/usr --with-zlib=/usr"
        make
        sudo make install
        popd
        rm -rf curl-7.10.3

        (i think that will work). BTW, you may want to run Disk Repair ", Repair Disk Permissions after the install (of curl and PHP both!) to change the binaries/libraries/etc to be writeable by group and belong to staff. :-)

        Take care,

        terry chay
        tychay at php dot net
  • mcrypt
    2003-01-21 08:48:03  anonymous2 [Reply | View]

    Has anyone gotten mcrypt to work? I try compiling with mcrypt using the fink libraries. The configure works just fine, but when I compile it gives me some error about changing a pointer to an int or something like that.
    • Adam Trachtenberg photo mcrypt
      2003-01-21 16:16:54  Adam Trachtenberg | O'Reilly Author [Reply | View]

      It took me a little while to get fink to install mcrypt -- it wasn't configured to read unstable files. But, after all that, I get the same result as you do.

      At first, I thought it was a problem with mcrypt 2.5.x instead of 2.4.x. But, I'm not positive about this anymore.

      Let me know if you make any progress on this.

      -adam
      • mcrypt
        2003-02-28 18:55:56  tychay [Reply | View]

        I had no problem compiling against the fink libraries. My Configure line:
        './configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-apxs=/usr/sbin/apxs' '--enable-soap=/sw' '--with-imagick=/sw' '--with-xmlrpc' '--with-pdflib=/sw' '--with-iodbc=/usr' '--with-mysql=/sw' '--with-mysql-sock=/private/tmp/mysql.sock' '--with-mnogosearch=/sw' '--with-ming=/sw' '--with-mime-magic' '--with-mhash=/sw' '--with-mcrypt=/sw' '--with-iconv=/sw' '--with-iconv-dir=/sw' '--with-gmp=/sw' '--with-gettext=/sw' '--with-gd' '--with-jpeg-dir=/sw' '--with-png-dir=/sw' '--with-xpm-dir=/sw' '--with-freetype-dir=/sw' '--with-t1lib=/sw' '--enable-gd-native-ttf' '--enable-exif' '--with-tiff-dir=/sw' '--with-dom=/sw' '--with-curl=/sw' '--with-curlwrappers' '--with-bz2=/sw' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-config-file-path=/etc' '--with-expat-dir=/sw' '--enable-wddx' '--enable-sockets' '--with-mm=/sw' '--enable-mbstring=all' '--enable-mbregex' '--enable-ftp' '--enable-dio' '--enable-dbx' '--enable-dba' '--with-db3=/sw' '--with-gdbm=/sw' '--with-ndbm=/usr' '--with-cdb' '--with-flatfile' '--enable-calendar' '--enable-bcmath' '--disable-debug' '--disable-short-tags'

        The version I am using is libmcrypt(-shlibs)-2.5.5-1 unstable package from Fink.

        My test script (Mac OS X 10.2.4, PB G4/800):

        bash-2.05a$ php -r 'echo base64_encode(mcrypt_ecb(MCRYPT_BLOWFISH, "key", "Something to encrypt",MCRYPT_ENCRYPT)),"\n";'
        HWiUtsE0PWDKoK6wtNTSiSjbdz0KUeLa

        Hope this helps,

        terry chay
        tychay at php dot net
  • ldap library...
    2003-01-19 16:13:40  anonymous2 [Reply | View]

    just use the one in /usr/lib that comes with OSX...
  • compile problems
    2003-01-19 02:50:10  anonymous2 [Reply | View]

    To compile GD library and Php is not easy because GD C headers are not in the correct place when the compiler try to get them.
    Use the pre-compiled php 4.3 from:
    www.entropy.ch
    and copy it into:
    /usr/local/sbin/httpd/
    and change the owner with chown root:wheel libphp4.so
    Bye
    Dino (Italy)
    • compile problems
      2003-01-19 11:56:08  maarky [Reply | View]

      There are currently no binaries of PHP 4.3 at www.entropy.ch. He does have a binary for RC3, but that's not the final version. If you want his binaries you should wait for him to come back from holiday so that you can get the current version.
  • What version??
    2003-01-17 13:33:40  anonymous2 [Reply | View]

    If I go to the download page, should I be downloading the regular php 4.3 or going to the Mac OSX link on the left side of the page and getting it there? The main download does not seem to be for the Mac.
    • Adam Trachtenberg photo What version??
      2003-01-17 21:44:52  Adam Trachtenberg | O'Reilly Author [Reply | View]

      If you want to configure and compile your own version of PHP, you should download the main one.

      The links on the side are for pre-compiled binary editions of PHP -- you cannot configure them. They're for people who cannot compile programs or don't wish to do so. Since prior to PHP 4.3 it was difficult to compile PHP on MacOS X, this was necessary. The big news is that now you don't need to use a pre-compiled binary.

      The PHP group just hasn't updated the web site -- probably since most MacOS X users aren't used to compiling their own software, even if most Unix people are.
  • Configuring with PHP 4.3's bundled libgd
    2003-01-17 02:46:25  maarky [Reply | View]

    I understand that PHP 4.3 includes its own bundled libgd. It is recommended to use the bundled library. Would you configure with --enable-gd to use this bundled library since it is after all a bundle or --with-gd?

    Of course I could probably get the answer using ./configure --help but I am new to compiling and would feel better getting the answer from a real live human being.
    • Adam Trachtenberg photo Configuring with PHP 4.3's bundled libgd
      2003-01-17 08:24:44  Adam Trachtenberg | O'Reilly Author [Reply | View]

      From ./configure --help:


      --with-gd[=DIR] Include GD support where DIR is GD install prefix.

      If DIR is not set, the bundled GD library will be used.


      So, it's --with-gd. That said, I don't believe PHP 4.3 works correctly on MacOS X with the bundled GD lib. This change landed very late in the release process and I don't think all the MacOS-specific fixes were made.


      Try it and let me know. If it works, great! If it doesn't, don't be surprised. I'll continue to fiddle with this and let you know when I get this working.

      • Configuring with PHP 4.3's bundled libgd
        2003-01-18 04:33:45  pierre_ [Reply | View]

        Hello,

        I do not meet any problem on MacOS X. But if you got any problem to compile php with the bundled lib, feel free to post a bugreport on bugs.php.net, we will fix asap.

        hth

        pierre
        • Adam Trachtenberg photo Configuring with PHP 4.3's bundled libgd
          2003-01-20 13:33:37  Adam Trachtenberg | O'Reilly Author [Reply | View]

          You're right. I got PHP to compile with the bundled version of GD.

          In addition to --with-gd, I needed to pass --with-png-dir=/sw because my libgd.a was in /sw/lib instead of /usr/lib.

          -adam
          • Configuring with PHP 4.3's bundled libgd
            2003-02-28 18:45:24  tychay [Reply | View]

            don't you mean libpng.a? ;-)

            The issue is that gd requires either libtiff or libpng (I think) to be available somewhere in your ld library path. Since neither is included by default in the Mac OS, the ./configure will fail with a very unhelpful error.

            Take care,

            terry chay
            tychay at php dot net
  • where is php.ini
    2003-01-17 00:45:01  anonymous2 [Reply | View]

    Anyone know where php.ini is installed after completing this process? I couldn't find it in /etc or /usr/lib/php.
    • where is php.ini
      2003-02-28 18:40:14  tychay [Reply | View]

      The default compile of php no longer installs a php.ini file.

      There are two included with the php distribution php.ini.dist and php.ini.recommended(?).

      The place to put the config file is in /etc/php.ini (if using Apple's directives) or /usr/local/etc/php.ini (if using the default configure, or Mark's compile). The quick way to find out (assuming php4.3+) is

      bash-2.05a$ php -r "phpinfo();" | grep Configuration
      Configuration File (php.ini) Path => /etc
      Configuration

      If you can't do that (because you are using pre 4.3, for shame!) then try the <?php phpinfo() ?> script another post mentioned.

      Hope this helps,

      terry chay
      tychay at php dot net
    • where is php.ini
      2003-01-17 02:27:18  maarky [Reply | View]

      I've always upgraded PHP using Mark Liyange's binaries (http://www.entropy.ch/software/macosx/php - he has been away since around mid December and hasn't updated his binaries, but he says he will be back around mid January and that he will update them then. Now that this article is out I may go ahead and update it myself.) In his FAQ he says that no php.ini file is included so if you want one you should create it here:

      /usr/local/lib/php.ini

      So that's what I did and it worked fine. I don't know if this is the proper location if you follow the instructions in this article.

      Another idea is to create a PHP file containing only:

      <?php phpinfo() ?>

      View this file in your browser. At the top in the first table you will see a cell labled "Configuration File (php.ini) Path". Check the path it gives in the next column over. If your php.ini file is not there then try creating one in that location.
  • GD with GIF? Ming?
    2003-01-16 22:26:46  dogzilla [Reply | View]

    While I understand that the developer of GD removed GIF support for (what to him is) a good reason, there are many of us who still rely on GIFs for much of our work, especially given the lackluster adoption of the PNG standard by most browser developers. I'd be really interested in finding a way to roll GIF support back in to the new GD code in PHP under OSX (I've already found a way to do it under my main FreeBSD servers).

    Additionally, I have wanted to build and install the Ming Flash creation library into PHP. I'm aware of the FreeMovie alternative and, while it shows promise, it's not as rich as Ming yet. If anyone has successfully done this, I'd love a HOW-TO.
    • GD with GIF? Ming?
      2003-02-28 21:30:27  tychay [Reply | View]

      Re: HOW TO Install Ming Extension into PHP 4.3 on Mac OS X 10.2

      1) In Fink Commander install "ming" and "ming-shlibs" packages

      2) Add the following line to your ./configure in the instructions that Adam gave:
      --with-ming=/sw

      3) Test it out by using a script at
      http://ming.sourceforge.net/examples/index.html

      4) Congratulations, You saved the universe from the evil clutches of Flash. :-)

      Take care,

      terry chay
      tychay at php dot net
    • Adam Trachtenberg photo GD with GIF? Ming?
      2003-01-17 08:19:19  Adam Trachtenberg | O'Reilly Author [Reply | View]

      PHP has started to bundle GD 2.x with its main distribution. They're also enabling GIF read-only support. I haven't gotten it to work on MacOS X, however, or I'd have included instructions in the article. I'll keep on trying.


      If you want GIF-write support, then that'll be much harder. (IMHO.) GD 1.2 (or whatever version it is) died long before MacOS X, so hacking that thing up will be a major PITA.

      • GD with GIF? Ming?
        2003-02-28 18:35:17  tychay [Reply | View]

        The problem (I found) with the built in bundled gd library working in MacOS X is related not having access to the libpng (etc) library. For instance, if you have Fink and have NOT installed gd, this works fine...

        --with-gd --with-jpeg-dir=/sw --with-png-dir=/sw --with-freetype-dir=/sw --with-t1lib=/sw

        assuming you've installed the libjpeg, libpng, libfreetype and libt1lib.

        As for GIF write support, other than patching GD, you can also try using imagemagick extension which is part of the PEAR/PECL library
        curl --remote-name http://pear.php.net/get/imagick-0.9.5.tgz
        unpack and install in your php/ext
        run ./buildconf before ./configure

        NOTE: AFAIK, you cannnot follow the regular build instructions for building ImageMagick as a shared extension because PHP4 on Mac OS X does not support dynamic loading of extensions (a real shame). PHP 5 does do this, however. :-)

        Also, you need to compile imagemagick, and thus --with-imagick=/sw ;-)

        Take care,

        terry
      • GD with GIF? Ming?
        2003-01-20 19:46:01  dogzilla [Reply | View]

        You're right that it's a PITA - I've been trying for over a year now. Here's one resource that makes me keep trying:

        http://www.rhyme.com.au/gd/
  • Steve Mallett photo include_path
    2003-01-16 19:43:26  Steve Mallett | O'Reilly Blogger [Reply | View]

    What is the proper syntax for dictating the include_path in .htaccess for php on os x??
    • include_path
      2003-01-17 02:15:55  maarky [Reply | View]

      Try entering this into your httpd.conf file:

      <IfModule mod_php4.c>
      php_value include_path "/Library/WebServer/Documents/"
      </IfModule>

      You will find a number of these <IfModule> ... </IfModule> entries in your config file. Place it after one of the closing </IfModule> statements. Change the path to whatever you want the include path to be. Also, if you have any virtual hosts set up you can add this inside the <VirtualHost *> ... </VirtualHost> statements. Again, change the path to correspond to the Virtual Host's path.

      Hope this helps.


Tagged Articles

Be the first to post this article to del.icio.us

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com