LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compile PHP (https://www.linuxquestions.org/questions/linux-newbie-8/compile-php-817574/)

jjena 07-02-2010 02:42 AM

Compile PHP
 
Hi ,

I am new to linux. I am using PHP Version 5.2.9. I am facing some problem for some the extension are not enabled.I want to enable that. The extensions are

with gdbm , -with-mysql, all with --with-gd' '--enable-dom' '--enable-dba' '--with-unixODBC' '--enable-pdo' '--enable-xmlreader' '--enable-xmlwriter' '--with-sqlite' '--enable-json' '--with-pspell'


--with-gd' '--enable-dom' '--enable-dba' '--with-unixODBC' '--enable-pdo' '--enable-xmlreader' '--enable-xmlwriter' '--with-sqlite' '--enable-json' '--with-pspell'

Kindly tell me how can I compile the PHP and make the modification like the above.

Thanks & Regards,
Jyotirmay

bathory 07-02-2010 03:11 AM

Hi,

You have to download the latest php sources (5.3.2 or 5.2.13 if you need a 5.2.x version), extract the archive, go into the directory php-5.x.x that was created and run ./configure using the options you want. E.g.
Code:

./configure --with gdbm --with-mysql --with-gd <rest of options>
You can run "./configure --help" to see the syntax of each option
Then if ./configure finishes without error you can run "make" and if this also finishes ok, su to root and run "make install"

Regards

jjena 07-03-2010 03:35 AM

I have followed your procedure & starts with php-5.2.13.
I tried with only for --with-mysql'

./configure --with-mysql
make
make install

After that I got a message.
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.3
[PEAR] Console_Getopt - already installed: 1.2.3
[PEAR] Structures_Graph- already installed: 1.0.2
[PEAR] XML_Util - already installed: 1.2.1
[PEAR] PEAR - already installed: 1.9.0
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/include/php/ext/pdo/


After that I restart the HHTPD service. But still it's showing --without-mysql'.


I think I doing something wrong. Kindly advice

bathory 07-03-2010 04:11 AM

What is the output of:
Code:

php -i|grep -i mysql
If you want to use php with a web server, you need to build also the php support for the web server. For apache you'll need:
Code:

./configure --with-mysql --with-apx2=/some/path/to/apxs
Note that's always better to run "make distclean" before running ./configure again

Regards

jjena 07-03-2010 07:02 AM

Hi,

Thanks for your reply..
The out put of php -i|grep -i mysql

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mssql.so' - libsybdb.so.5: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_dblib.so' - libsybdb.so.5: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_oci.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/sqlite.so' - libsqlite.so.0: cannot open shared object file: No such file or directory in Unknown on line 0
Configure Command => './configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mime-magic=/usr/share/file/magic' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--with-oci8=shared,instantclient,/usr/lib/oracle/11.1.0.7/client/lib,11.1.0.7' '--with-pdo-oci=shared,instantclient,/usr,11.1.0.7' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--with-sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--enable-dbase=shared' '--with-pspell=shared' '--with-mcrypt=shared,/usr' '--with-mhash=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--with-recode=shared,/usr'
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo_mysql.ini,
mysql
MySQL Support => enabled
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /var/lib/mysql/mysql.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib/mysql -lmysqlclient
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => no value => no value
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MysqlI Support => enabled
MYSQLI_SOCKET => /var/lib/mysql/mysql.sock
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.reconnect => Off => Off
PDO drivers => mysql, odbc, pgsql, sqlite
pdo_mysql
PDO Driver for MySQL, client library version => 5.1.35


As I amnew to linux not getting the proper idea to compile PHP.
Kindly revert

bathory 07-03-2010 08:46 AM

This is the output of the php that was installed previously in your box.
The one you're trying to install is in /usr/local/bin, so you have to use:
Code:

/usr/local/bin/php -i |grep -i mysql
for the same

But, from what I can see from the old php configure and the output of the command, mysql support is present in the old php.
Also it looks like your previous php does not lack the support for the things you mentioned in your 1st post (except gdbm).
What you miss is some packages, like php-mssql etc
So I don't know why you want to mess with compiling a new php.


All times are GMT -5. The time now is 06:58 AM.