LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   errors in php/mysql (https://www.linuxquestions.org/questions/slackware-14/errors-in-php-mysql-379054/)

skybell 11-01-2005 02:39 PM

errors in php/mysql
 
Hi everybody, I can not use properly mysql on php web pages. It always gives me strage errors and I think it's related to my amp configuration. Everything goes smooth when I program under mysql itself and when I create web pages in php with the support of Apache. I have follow this guide:

http://www.linuxquestions.org/questi...icle&artid=456

I installed amp with these packages from linuxpackages.net:

apache2-2.0.54
mysql-5.1.14
php-apache2-5.0.4
t1lib-5.1.0
the kernel installed is 2.6.12.5

the error log of apache is:

[Tue Nov 01 20:15:23 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations
[Tue Nov 01 20:17:52 2005] [notice] caught SIGTERM, shutting down
[Tue Nov 01 20:34:57 2005] [notice] Digest: generating secret for digest authentication ...
[Tue Nov 01 20:34:57 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/imap.so' - /usr/lib/php/extensions/imap.so: 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/extensions/ldap.so' - libldap-2.3.so.0: 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/extensions/mcrypt.so' - libmcrypt.so.4: 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/extensions/odbc.so' - libodbc.so.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/extensions/pgsql.so' - libpq.so.3: 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/extensions/snmp.so' - libnetsnmp.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/extensions/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Tue Nov 01 20:34:59 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations [client 127.0.0.1] PHP Notice: Undefined variable: aid in /var/www/htdocs/php-nuke/admin.php on line 16
[client 127.0.0.1] PHP Notice: Undefined variable: HTTP_SERVER_VARS in /var/www/htdocs/php-nuke/mainfile.php on line 47
[client 127.0.0.1] PHP Notice: import_request_variables() [<a href='function.import-request-variables'>function.import-request-variables</a>]: No prefix specified - possible security hazard in /var/www/htdocs/php-nuke/mainfile.php on line 64
[client 127.0.0.1] PHP Notice: Undefined variable: HTTP_SERVER_VARS in /var/www/htdocs/php-nuke/mainfile.php on line 47
[client 127.0.0.1] PHP Notice: import_request_variables() [<a href='function.import-request-variables'>function.import-request-variables</a>]: No prefix specified - possible security hazard in /var/www/htdocs/php-nuke/mainfile.php on line 64

vireshwali 11-02-2005 01:00 AM

Hi,
seems like you did not do the fine tuning of PHP.

Open /etc/php.ini (or which ever folder you have the php.ini in) and comment out all extension you see as errors in the apache error log. eg: imap.so
From the log dump it seems that all your extension are present in /usr/lib/php/extensions/. Check if they really exist there or not.
And finally i would suggest you to set the register_globals variable in php.ini file to On. PHP now has display globals set to Off by default. So you are extected to use $_POST,$_GET,$_SESSION etc.
Since i see you ate trying to use HTTP_VARS so you need to set register_globals to On in your php.ini file.

restart apache now and try.
Things should work else i am here to make them work for you :)

skybell 11-02-2005 11:46 AM

First of all thank you for your attention to my issue.
I have the same errors, the new log error is similar to the first one:

[Wed Nov 02 18:37:25 2005] [notice] Digest: generating secret for digest authentication ...
[Wed Nov 02 18:37:25 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/imap.so' - /usr/lib/php/extensions/imap.so: 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/extensions/ldap.so' - libldap-2.3.so.0: 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/extensions/mcrypt.so' - libmcrypt.so.4: 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/extensions/odbc.so' - libodbc.so.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/extensions/pgsql.so' - libpq.so.3: 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/extensions/snmp.so' - libnetsnmp.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/extensions/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Wed Nov 02 18:37:27 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations
[client 127.0.0.1] PHP Notice: Undefined variable: aid in /var/www/htdocs/php-nuke/admin.php on line 16

-------------------------------------------------------------

All extensions were comment out in the php.ini:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.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.

extension=imap.so
extension=ldap.so
extension=mcrypt.so
extension=mhash.so
extension=odbc.so
extension=pgsql.so
extension=pspell.so
extension=snmp.so
extension=mysql.so

---------------------------------------------------------------------------------

The shared object files exist:

root@galaxy:/home/sky# ls -l /usr/lib/php/extensions/
total 340
-rwxr-xr-x 1 root root 42488 2005-07-28 01:07 ldap.so
-rwxr-xr-x 1 root root 34589 2005-07-28 01:07 mcrypt.so
-rwxr-xr-x 1 root root 9814 2005-07-28 01:07 mhash.so
-rwxr-xr-x 1 root root 40244 2005-04-04 04:15 mysql.so
-rwxr-xr-x 1 root root 60554 2005-07-28 01:07 odbc.so
-rwxr-xr-x 1 root root 89074 2005-07-28 01:07 pgsql.so
-rwxr-xr-x 1 root root 23421 2005-07-28 01:07 pspell.so
-rwxr-xr-x 1 root root 27747 2005-07-28 01:07 snmp.so

-----------------------------------------------------------------------------------

I set the register_globals, register_long_arrays, register_argc_argv to ON in the php.ini:

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3

; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
;arg_separator.output = "&amp;"

; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
;arg_separator.input = ";&"

; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
; referred to as EGPCS or GPC). Registration is done from left to right, newer
; values override older values.
variables_order = "GPCS"

; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.
;
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = on

; Whether or not to register the old-style input arrays, HTTP_GET_VARS
; and friends. If you're not using them, it's recommended to turn them off,
; for performance reasons.
register_long_arrays = on

; This directive tells PHP whether to declare the argv&argc variables (that
; would contain the GET information). If you don't use these variables, you
; should turn it off for increased performance.
register_argc_argv = on

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

vireshwali 11-03-2005 01:37 AM

ok
one of ur problems is solved, that of using HTTP_VARS. Your new dump is not showing any errors relating to that.
Try the following:
1) look for something like the following in your php.ini file
===========================================================
; Directory in which the loadable extensions (modules) reside.
extension_dir = /usr/lib/php4
===========================================================
This is the directory where php will search for loadable module extensions.
check if this is set to /usr/lib/php/extensions/ if not the set it to /usr/lib/php/extensions/ and restart apache.
If yes try the following

2) cd /usr/lib/php/extensions/
chmod 777 ./*

restart apache and paste the dump here if errors persist.

skybell 11-03-2005 02:21 PM

The extension_dir is correct:

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; 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/php/extensions/"

; 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

----------------------------------------------------------------------------------

I've given the 777 permissions:

root@galaxy:/usr/lib/php/extensions# chmod 777 ./*
root@galaxy:/usr/lib/php/extensions# ls -l
total 340
-rwxrwxrwx 1 root root 42488 2005-07-28 01:07 ldap.so
-rwxrwxrwx 1 root root 34589 2005-07-28 01:07 mcrypt.so
-rwxrwxrwx 1 root root 9814 2005-07-28 01:07 mhash.so
-rwxrwxrwx 1 root root 40244 2005-04-04 04:15 mysql.so
-rwxrwxrwx 1 root root 60554 2005-07-28 01:07 odbc.so
-rwxrwxrwx 1 root root 89074 2005-07-28 01:07 pgsql.so
-rwxrwxrwx 1 root root 23421 2005-07-28 01:07 pspell.so
-rwxrwxrwx 1 root root 27747 2005-07-28 01:07 snmp.so
root@galaxy:/usr/lib/php/extensions# /etc/rc.d/rc.httpd restart

---------------------------------------------------------------------------------

The log is the same:

[Thu Nov 03 20:27:04 2005] [notice] SIGHUP received. Attempting to restart
[Thu Nov 03 20:27:04 2005] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 03 20:27:04 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/imap.so' - /usr/lib/php/extensions/imap.so: 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/extensions/ldap.so' - libldap-2.3.so.0: 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/extensions/mcrypt.so' - libmcrypt.so.4: 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/extensions/odbc.so' - libodbc.so.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/extensions/pgsql.so' - libpq.so.3: 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/extensions/snmp.so' - libnetsnmp.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/extensions/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Thu Nov 03 20:27:05 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations
[client 127.0.0.1] PHP Notice: Undefined variable: aid in /var/www/htdocs/php-nuke/admin.php on line 16

planoru 11-04-2005 03:09 AM

PHP5.0.X uses ext and not extensions dir for the extensions lib's. So it should be
/usr/lib/php/ext

skybell 11-04-2005 06:02 AM

I've renamed /usr/lib/php/extensions to /usr/lib/php/ext and I've modified the php.ini to use the new folder:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/lib/php/ext/"

The apache log:

[Fri Nov 04 08:56:46 2005] [notice] caught SIGTERM, shutting down
[Fri Nov 04 08:58:15 2005] [notice] Digest: generating secret for digest authentication ...
[Fri Nov 04 08:58:15 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/imap.so' - /usr/lib/php/extensions/imap.so: 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/extensions/ldap.so' - libldap-2.3.so.0: 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/extensions/mcrypt.so' - libmcrypt.so.4: 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/extensions/odbc.so' - libodbc.so.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/extensions/pgsql.so' - libpq.so.3: 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/extensions/snmp.so' - libnetsnmp.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/extensions/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Fri Nov 04 08:58:17 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations
[Fri Nov 04 12:55:57 2005] [notice] SIGHUP received. Attempting to restart
[Fri Nov 04 12:55:58 2005] [notice] Digest: generating secret for digest authentication ...
[Fri Nov 04 12:55:58 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/ext/imap.so' - /usr/lib/php/ext/imap.so: 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/ext/ldap.so' - libldap-2.3.so.0: 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/ext/mcrypt.so' - libmcrypt.so.4: 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/ext/odbc.so' - libodbc.so.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/ext/pgsql.so' - libpq.so.3: 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/ext/snmp.so' - libnetsnmp.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/ext/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Fri Nov 04 12:55:59 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations
[Fri Nov 04 12:56:08 2005] [notice] caught SIGTERM, shutting down
[Fri Nov 04 12:56:22 2005] [notice] Digest: generating secret for digest authentication ...
[Fri Nov 04 12:56:22 2005] [notice] Digest: done
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/ext/imap.so' - /usr/lib/php/ext/imap.so: 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/ext/ldap.so' - libldap-2.3.so.0: 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/ext/mcrypt.so' - libmcrypt.so.4: 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/ext/odbc.so' - libodbc.so.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/ext/pgsql.so' - libpq.so.3: 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/ext/snmp.so' - libnetsnmp.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/ext/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0
[Fri Nov 04 12:56:23 2005] [notice] Apache/2.0.54 (Unix) DAV/2 PHP/5.0.4 configured -- resuming normal operations

planoru 11-04-2005 07:36 AM

Sorry, I have missleaded U with the /ext dir thing. Your problem with the package that U have installed.
This is what I think it happend:
-the pack that U have installed lacks the suport for mysql and what U have in the /usr/lib/php/extensions/ is an old mysql lib file from the php package that came with the cd. Al What I would sugest is to remove what U have installed, and reinstall the packages that U have on your cd or from some ftp server. Or if U really want the newest, uninstall the packages that U have and use the source codes. This is the best way in linux, this way it will fit your machine and tell U if something is missing.

skybell 11-04-2005 08:01 AM

I'm using the latest packages from linuxpackages.net as I said in my first post. If the solution is hard to find it, I will install everything from source.
Anyway I hope that Vireshwali will give more advices.

Thank you

vireshwali 11-07-2005 01:32 AM

try out this post thread and its subsequent replies to understand better your problem.
I am hoping you are starting apache from root privilege.

that is i mean to say that you first do an su - in a consol and then type the apache startup command.

http://bugs.php.net/bug.php?id=30636

Potentially these are bugs in the new distro of PHP, the one that comes bundled with linux.
I suggest downloading the rpms from better sources that are dedicated more to php than to linux core.
Go through the post and let me know if you face problems.

vireshwali 11-07-2005 02:03 AM

hey, may be i figured it out.

remove the last trailing backslash or slash or what ever it is called (the /) from the extension_dir value.

from your last few posts i can see that you have it set as
extension_dir = "/usr/lib/php/ext/"

change this to the one below

extension_dir = /usr/lib/php/ext

and try running apache

skybell 11-07-2005 01:24 PM

To trick the bug reported also on PHP Bugs Support, on the php.ini I've commented the dynamic libraries that were missing . Even if it's not the best solution, now the Apache log is regular.

Phpnuke is still giving error messages related to mysql but I think is just a bug on there software. Infact to test the interaction between Php and Mysql I manage some Mysql databases with Phpmyadmin and it's working great.

Thank You for your help

vireshwali 11-08-2005 02:34 AM

hi,
i would like to have a look at those php nuke errors please, if you dont mind sharing them.

And yes commenting out the libraries in php.ini which are not there in the extension dir is absolutely the right way to go. What you have done is the standard way to tune up php.

davidsrsb 11-11-2005 10:59 PM

The bug introduced in php 4.4.1 also breaks squirrelmail

It is supposed to be fixed in the php cvs.


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