Jump to content

[SOLVED] Newbie madness: How to install PHP extensions (PHP 5.0.4, Linux/FC4) ?


Recommended Posts

Hi all -

 

I am new to to Linux, and I am tearing out my hair getting a bunch of extensions installed on PHP 5.0.4 on a Fedora Core 4 Linux distribution on a dedicated server. I need the following extensions: gmp, mcrypt, pdo_mysql and http. None of these was bundled with the existing system, so apparently I need to get them from somewhere.

 

On my Windows development environment, I just grabbed the respective DLLs from php.net and done. Kudos to Microsoft.

 

On Linux, this appears to be much more of an ordeal. Since I could not locate an RPM anywhere that has the .so binaries ready to roll, I figured I need to build the extensions myself, using the PECL command. Unfortunalety, my distribution does not have the pecl command, so finally figured out to use the pear command instead. After a bunch of mysterious errors and lots of cursing I figured I need the autoconf, automake and libtools packages. After more cursing and getting the autoconv, automake, libtools, gcc, cpp, glibc-devel and glibc-headers packages as well, I figured I need the kernel-headers package for my kernel (2.6.9) which I cannot locate anywhere. So I am dead in the water. What a friggin' nightmare!

 

Also, I don't want to touch php itself since I don't want to risk blowing up my server's control panel (Plesk) which also uses the same php.

 

Please, please anyone pointing me in the right direction would be enormously appreciated!! I just need those four extensions <sob>!!

 

Thanks!!!

Markus

Link to comment
Share on other sites

Actually, when I run the pear installer, here's what I get:

 

# pear -d default_channel=pecl.php.net -d preferred_mirror=pecl.php.net install PDO

WARNING: running in safe mode requires that all files created be the same uid as the current script.  PHP reports this script is uid: 0, and current user is: root

downloading PDO-1.0.3.tgz ...

Starting to download PDO-1.0.3.tgz (52,613 bytes)

.............done: 52,613 bytes

12 source files, building

 

Warning: putenv(): Safe Mode warning: Cannot set environment variable 'PATH' - it's not in the allowed list in Builder.php on line 244

running: phpize

Configuring for:

PHP Api Version:        20031224

Zend Module Api No:      20041030

Zend Extension Api No:  220040412

building in /var/tmp/pear-build-root/PDO-1.0.3

running: /tmp/tmpNY7O4G/PDO-1.0.3/configure

sh: /configure: No such file or directory

`/tmp/tmpNY7O4G/PDO-1.0.3/configure' failed

#

 

I figured that I need the libtools package but maybe something else will work as well.

 

Thanks again,

Markus

Link to comment
Share on other sites

Ok, I managed to install libtools by using the kernel headers for 2.6.18 despite my kernel being 2.6.9 (hope that won't blow up later). Still I get the same error

 

sh: /configure: No such file or directory

 

Any help is appreciated.

 

Markus

Link to comment
Share on other sites

Its actually quite simple to build php extensions in Linux. All you need do is download the php source code from php.net, unpack it, cd into the new php-* directory, cd into the ext directory, cd into the directory containing the extension you want to build. From there run...

 

phpize
./configure --help
make

 

Of course you may need to add configure options once youv'e view the help. Once thats done, just copy the newly created *.so into your extensions directory (can be found in your php.ini).

 

Unfortunatly though, without the build tools its going to be a bit more difficult. This is one reason I left redhat prior to Fedora. What kind of Linux distro doesn't have the build tools in place to compile software?

Link to comment
Share on other sites

Thanks for the info!

 

I did that and tried to build mcrypt and gmp. phpize works fine, then

 

# ./configure

 

results in:

 

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

The folder has no mcrypt.h, only a php_mcrypt.h. mcrypt.h does not exist anywhere on my file system. So I tried

 

cp php_mcrypt.h mcrypt.h

 

No use, still the same error.

 

Same with gmp.

 

Any hints? Need specific options? (I tried --with-mcrypt=. to no avail)

 

I am running Fedora Core 4 on a dedicated server (came with that). I am surprised, too, that the compiler was not installed if it's such an essential tool.

 

Thanks again,

Markus

 

P.S.: Options are:

 

# ./configure --help

`configure' configures this package to adapt to many kinds of systems.

 

Usage: ./configure [OPTION]... [VAR=VALUE]...

 

To assign environment variables (e.g., CC, CFLAGS...), specify them as

VAR=VALUE.  See below for descriptions of some of the useful variables.

 

Defaults for the options are specified in brackets.

 

Configuration:

  -h, --help              display this help and exit

      --help=short        display options specific to this package

      --help=recursive    display the short help of all the included packages

  -V, --version          display version information and exit

  -q, --quiet, --silent  do not print `checking...' messages

      --cache-file=FILE  cache test results in FILE [disabled]

  -C, --config-cache      alias for `--cache-file=config.cache'

  -n, --no-create        do not create output files

      --srcdir=DIR        find the sources in DIR [configure dir or `..']

 

Installation directories:

  --prefix=PREFIX        install architecture-independent files in PREFIX

                          []

  --exec-prefix=EPREFIX  install architecture-dependent files in EPREFIX

                          [PREFIX]

 

By default, `make install' will install all the files in

`/bin', `/lib' etc.  You can specify

an installation prefix other than `' using `--prefix',

for instance `--prefix=$HOME'.

 

For better control, use the options below.

 

Fine tuning of the installation directories:

  --bindir=DIR          user executables [EPREFIX/bin]

  --sbindir=DIR          system admin executables [EPREFIX/sbin]

  --libexecdir=DIR      program executables [EPREFIX/libexec]

  --datadir=DIR          read-only architecture-independent data [PREFIX/share]

  --sysconfdir=DIR      read-only single-machine data [PREFIX/etc]

  --sharedstatedir=DIR  modifiable architecture-independent data [PREFIX/com]

  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]

  --libdir=DIR          object code libraries [EPREFIX/lib]

  --includedir=DIR      C header files [PREFIX/include]

  --oldincludedir=DIR    C header files for non-gcc [/usr/include]

  --infodir=DIR          info documentation [PREFIX/info]

  --mandir=DIR          man documentation [PREFIX/man]

 

System types:

  --build=BUILD    configure for building on BUILD [guessed]

  --host=HOST      cross-compile to build programs to run on HOST [bUILD]

 

Optional Features:

  --disable-FEATURE      do not include FEATURE (same as --enable-FEATURE=no)

  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]

  --enable-shared[=PKGS]

                          build shared libraries [default=yes]

  --enable-static[=PKGS]

                          build static libraries [default=yes]

  --enable-fast-install[=PKGS]

                          optimize for fast installation [default=yes]

  --disable-libtool-lock  avoid locking (might break parallel builds)

 

Optional Packages:

  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]

  --without-PACKAGE      do not use PACKAGE (same as --with-PACKAGE=no)

  --with-php-config=PATH

  --with-mcrypt=DIR    Include mcrypt support.

  --with-gnu-ld          assume the C compiler uses GNU ld [default=no]

  --with-pic              try to use only PIC/non-PIC objects [default=use

                          both]

  --with-tags[=TAGS]

                          include additional configurations [automatic]

 

Some influential environment variables:

  CC          C compiler command

  CFLAGS      C compiler flags

  LDFLAGS    linker flags, e.g. -L<lib dir> if you have libraries in a

              nonstandard directory <lib dir>

  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have

              headers in a nonstandard directory <include dir>

  CPP        C preprocessor

  CXX        C++ compiler command

  CXXFLAGS    C++ compiler flags

  CXXCPP      C++ preprocessor

  F77        Fortran 77 compiler command

  FFLAGS      Fortran 77 compiler flags

 

Use these variables to override the choices made by `configure' or to help

it to find libraries and programs with nonstandard names/locations.

 

#

Link to comment
Share on other sites

I found a libmcrypt RPM (libmcrypt-2.5.7-4.fc4.i386.rpm) and installed it (ran "rpm -ivh" on it) - to no avail, still get that "mcrypt.h not found" error.

 

Yum is apparently not part of my distro (?), so I downloaded it and tried to install it according to the instructions - unzip it, cd to it and "run make". Then I get:

-bash: run: command not found

 

When I just type "make",

 

for d in rpmUtils yum etc docs; do make PYTHON=python -C $d; [ $? = 0 ] || exit 1 ; done

make[1]: Entering directory `/tmp/yum-3.2.2/rpmUtils'

echo "Nothing to do"

Nothing to do

make[1]: Leaving directory `/tmp/yum-3.2.2/rpmUtils'

make[1]: Entering directory `/tmp/yum-3.2.2/yum'

echo "Nothing to do"

Nothing to do

make[1]: Leaving directory `/tmp/yum-3.2.2/yum'

make[1]: Entering directory `/tmp/yum-3.2.2/etc'

echo "Nothing to do"

Nothing to do

make[1]: Leaving directory `/tmp/yum-3.2.2/etc'

make[1]: Entering directory `/tmp/yum-3.2.2/docs'

echo "Nothing to do"

Nothing to do

make[1]: Leaving directory `/tmp/yum-3.2.2/docs'

 

And the "yum" command continues to be unknown. I am just so at a loss...

 

Markus

 

 

Link to comment
Share on other sites

Hmm, it seems increasingly so as if I am just using a sucky distribution.

 

Can anyone recommend a good distribution where all this LAMP stuff just works out of the box, with yum, gcc, bison, php, pear, pecl and all the goodness? Where I just type "pecl install pdo" and that's it? Where I can recompile PHP with a few commands if I want to without stuff failing left and right?

 

Thanks!

Markus

Link to comment
Share on other sites

http is installed via PECL, read the instructions here. What problems are you haing with pdo_mysql ? You need to have the mysql headers installed, which means you'll probably need some mysql-dev package installed unless you installed mysql from source. You'll also need to install pdo prior to pdo_mysql.

 

The YUM thing was a bit of a bum steer on my part. I though YUM was the fedora package manager, its not, its belongs to suse. You don't need it.

 

Most of the issues you are having simply relate to the fact that fedora expects you to use packages for everything. it doesn't expect you to want / need to compile stuff yourself. There should be a package (maybe toolchain?) that should install the tools required to compile successfully.

 

The rest of the issues you are having are simply due to dependencies. This is hwo compiling from source is unforunately. Programs rely on other programs. Sometimes just for the build process and sometimes to actually run.

 

You need to researhc a packages dependencies prior to compiling so that you know you have the tools required for the job.

 

If your looking for a recomendation for a good server distro I would recomend debian. Its been around a long time, very well maintained, more packages than any other distro and everything is where it should be.

 

Personally I use Debian for my servers and Gentoo for most other stuff. Gentoo is a fair bit of work to maintain or Id'e recomend that as a server too. But yeah... debian is probably the best option IMO.

Link to comment
Share on other sites

Hi thorpe -

 

Just for the record, I successfully built pdo/pdo_mysql and http, and got the site to run with some glitches. However, the php commandline segfaults with the http extension active. I then tried to install Zend platform for debugging which was unsuccessful - system became a bit unstable after that. Then I experimented with XAMPP until the system became even more unstable.

 

So I decided to abandon that system and move to a new VPS with CentOS 5 (couldn't find one with Debian Etch), yum and stuff, and installed everything from scratch again on that server. Went much smoother, thanks to yum, and most of my site runs now without glitches. I even managed to successfully build apache 2.2.4 and php 5.2.3 with the full deck of extensions from source (proud newbie here!). Only problem left I cannot get Lucene/Java to run on JRE 6u2/Linux (get "error in opening zip file" all the time, jeez..., the JavaBridge.jar runs fine though, and the same Lucene Jar runs fine on JRE/Windows), so I am struggling with that at the moment. Otherwise I am a happy LAMP camper now.

 

Thanks thorpe for your info, it really helped me understand all this stuff much better.

 

Markus

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.