Jump to content

Recommended Posts

Hi

 

I been working on this issue for a couple days without success. PHP.ini will not load extensions. I am able to modify php.ini parameters successfully with the exception of the extensions. It would be appreciated if someone can shed some light on this issue.

 

Troublshoot

check for multiply php.ini

restart apache

 

 

1. Environment:

 

CentoOS 5.2

Apache2

PHP 5.11

 

2. dir

apache2= /usr/local/apache2

php = /usr/local/apache2/php

lib = /usr/lib which contains pdo.so, pdo_mysql.so, sqlite.so, pdo_sqlite.so

 

3. security

firewall=disable

selinux =disable

 

4. php.ini (path directories and extensions)

 

;;;;;;;;;;;;;;;;;;;;;;;;;

; Paths and Directories ;

;;;;;;;;;;;;;;;;;;;;;;;;;

 

; UNIX: "/path1:/path2"

include_path = ".:/php/includes :/usr/share/pear:/local/PEAR :/usr/local/apache2/php/lib/pub :/usr/lib"

 

;

; Windows: "\path1;\path2"

;include_path = ".;c:\php\includes"

 

; The root of the PHP pages, used only if nonempty.

; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root

; if you are running php as a CGI under any web server (other than IIS)

; see documentation for security issues. The alternate is to use the

; cgi.force_redirect configuration below

doc_root =

 

; The directory under which PHP opens the script using /~username used only

; if nonempty.

user_dir =

 

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/usr/lib/"

 

; Whether or not to enable the dl() function. The dl() function does NOT work

; properly in multithreaded servers, such as IIS or Zeus, and is automatically

; disabled on them.

enable_dl = On

 

; cgi.force_redirect is necessary to provide security running PHP as a CGI under

; most web servers. Left undefined, PHP turns this on by default. You can

; turn it off here AT YOUR OWN RISK

; **You CAN safely turn this off for IIS, in fact, you MUST.**

; cgi.force_redirect = 1

; if cgi.nph is enabled it will force cgi to always sent Status: 200 with

; every request.

; cgi.nph = 1

 

; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape

; (iPlanet) web servers, you MAY need to set an environment variable name that PHP

; will look for to know it is OK to continue execution. Setting this variable MAY

; cause security issues, KNOW WHAT YOU ARE DOING FIRST.

; cgi.redirect_status_env = ;

 

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate

; security tokens of the calling client. This allows IIS to define the

; security context that the request runs under. mod_fastcgi under Apache

; does not currently support this feature (03/17/2002)

; Set to 1 if running under IIS. Default is zero.

; fastcgi.impersonate = 1;

 

; cgi.rfc2616_headers configuration option tells PHP what type of headers to

; use when sending HTTP response code. If it's set 0 PHP sends Status: header that

; is supported by Apache. When this option is set to 1 PHP will send

; RFC2616 compliant header.

; Default is zero.

;cgi.rfc2616_headers = 0

 

 

;;;;;;;;;;;;;;;;

; File Uploads ;

;;;;;;;;;;;;;;;;

 

; Whether to allow HTTP file uploads.

file_uploads = On

 

; Temporary directory for HTTP uploaded files (will use system default if not

; specified).

;upload_tmp_dir =

 

; Maximum allowed size for uploaded files.

upload_max_filesize = 2M

 

;;;;;;;;;;;;;;;;;;

; Fopen wrappers ;

;;;;;;;;;;;;;;;;;;

 

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.

allow_url_fopen = On

 

; Define the anonymous ftp password (your email address)

;from="john@doe.com"

 

; Define the User-Agent string

; user_agent="PHP"

 

; Default timeout for socket based streams (seconds)

default_socket_timeout = 60

 

; If your scripts have to deal with files from Macintosh systems,

; or you are running on a Mac and need to deal with files from

; unix or win32 systems, setting this flag will cause PHP to

; automatically detect the EOL character in those files so that

; fgets() and file() will work regardless of the source of the file.

; auto_detect_line_endings = Off

 

 

;;;;;;;;;;;;;;;;;;;;;;

; Dynamic Extensions ;

;;;;;;;;;;;;;;;;;;;;;;

;

; If you wish to have an extension loaded automatically, use the following

; syntax:

;

; extension=modulename.extension

;

; For example:

;

extension=pdo.so

extension=pdo_mysql.so

extension=sqlite.so

extension=pdo_sqlite.so

;

;

; Note that it should be the name of the module only; no directory information

; needs to go here. Specify the location of the extension with the

; extension_dir directive above.

 

 

;;;;

; Note: packaged extension modules are now loaded via the .ini files

; found in the directory /etc/php.d; these are loaded by default.

;;;;

 

5. compile script

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/bin/mysql --prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --with-pear --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --with-gd --with-curl --with-mcrypt=/usr/local/bin/mcrypt --enable-pdo=shared --with-pdo-mysql=shared --with-sqlite=shared --with-pdo-sqlite=shared

 

6. Output

 

<h2>PHP Extensions</h2>

<?print_r(get_loaded_extensions()); ?>

 

 

Array ( [0] => date [1] => libxml [2] => pcre [3] => zlib [4] => bcmath [5] => calendar [6] => ctype [7] => curl [8] => dba [9] => dom [10] => filter [11] => ftp [12] => gd [13] => gettext [14] => hash [15] => iconv [16] => json [17] => mcrypt [18] => mysql [19] => posix [20] => Reflection [21] => session [22] => SimpleXML [23] => SPL [24] => sockets [25] => standard [26] => tokenizer [27] => xml [28] => xmlreader [29] => xmlwriter [30] => apache2handler )

 

thanks for your support

Link to comment
https://forums.phpfreaks.com/topic/178367-php-extension-will-not-load/
Share on other sites

8) Finally got the extension to load

I was able to load the extensions in question by recompiling with the below configuration vs loading using php.ini.

 

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/bin/mysql --prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php  --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --without-pear --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --with-gd --with-curl --with-mcrypt=/usr/local/bin/mcrypt --enable-pdo --with-pdo-mysq --with-sqlite --with-pdo-sqlite

 

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.