PHP/MySQL Link in Red Hat 8.0
Moderator: General Moderators
PHP/MySQL Link in Red Hat 8.0
I'm running RH 8.0, and MySQL, PHP, and Apache all seem to be working independently of one another. What I can't get to work are the links between my
.php files and the MySQL server. I'm successfully publishing .html and .php
pages to Apache from a user's directory. Then, after creating a MySQL account
and databases for the same user, I used this command to link to the database
server from the .php page:
<?php
$dbcnx = @mysql_connect("localhost", "user", "userpwd");
if (!$dbcnx) {
echo ("<p>Unable to connect to the server at this time.</p>");
exit();
}
?>
With this command, the page displays up to the spot of the command,
and then dies. If I remove the @ from "@mysql_connect (thus turning on the PHP
errors), I get this: "
Fatal error: Call to undefined function: mysql_connect() in
/home/user/public_html/index.php on line 16
I checked my phpinfo() and my php.ini, and by all appearances MySQL support has been installed for PHP (I installed all the packages at installation time). Any ideas?
Dave
.php files and the MySQL server. I'm successfully publishing .html and .php
pages to Apache from a user's directory. Then, after creating a MySQL account
and databases for the same user, I used this command to link to the database
server from the .php page:
<?php
$dbcnx = @mysql_connect("localhost", "user", "userpwd");
if (!$dbcnx) {
echo ("<p>Unable to connect to the server at this time.</p>");
exit();
}
?>
With this command, the page displays up to the spot of the command,
and then dies. If I remove the @ from "@mysql_connect (thus turning on the PHP
errors), I get this: "
Fatal error: Call to undefined function: mysql_connect() in
/home/user/public_html/index.php on line 16
I checked my phpinfo() and my php.ini, and by all appearances MySQL support has been installed for PHP (I installed all the packages at installation time). Any ideas?
Dave
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
PHP has been compiled without MySQL support - you need to recompile it so that it does include the MySQL functions (eg: --with-mysql):
http://www.php.net/manual/en/install.configure.php
Mac
http://www.php.net/manual/en/install.configure.php
Mac
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I have the same problem
I have the exact same problem. Also running the (otherwise great) new RH 8.0.
MySQL, Apache 2 and PHP were all installed during system install and it would appear that php does support MySQL (but then I'm only a novice).
Did you try recompiling Dapclark ? If so - did it work out for you ?
Kind regards Soren ONeill, Denmark
MySQL, Apache 2 and PHP were all installed during system install and it would appear that php does support MySQL (but then I'm only a novice).
Did you try recompiling Dapclark ? If so - did it work out for you ?
Kind regards Soren ONeill, Denmark
Could this be where the dog lies burried ?
I looked up my phpinfo and found the same line (and also --with-snmp=shared,/user ) . Could this be the problem ? Was the mysql and snmp modules installed into the wrong (non-existing ?) directories ?dapclark wrote:But when I do phpinfo (), under "Configure Command" it says that MySQL is included:
'--with-mysql=shared,/usr'
Or am I reading this wrong?
Dave
Soren ONeill, Denmark
same problem
I am running rh 8.0 and am stuck with the same problem.
Re: same problem
I have actually solved my problem in the meantime - firstly make sure, the mysql deamon is running (yes I forgot .. DOH!) , if that doesnt do the trick; run:hardawayd wrote:I am running rh 8.0 and am stuck with the same problem.
rpm -qa | grep mysql
and look at the list of installed packages (you might wanna do so as root). There should be a package called php-mysql-xxxxxx.rpm (xxxxx is the version number currently 4.something). I downloaded it from http://www.rpmfind.net installed it and as far as i can tell my show is on the road now ...
Soren ONeill, Denmark
I installed it but still no luck. when i do ps ax it shows this: Does this mean that mysql is running because even after I installed php-mysqlxxxx it says that the mysql_connect function is not there.
615 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
647 ? S 0:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --
615 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
647 ? S 0:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --
Well when I run: ps ax | grep mysql - I get roughly the same output, when mysql deamon is up and running. You can always try to start up the promt-line MySQL front by running: mysql from bash.hardawayd wrote:I installed it but still no luck. when i do ps ax it shows this: Does this mean that mysql is running because even after I installed php-mysqlxxxx it says that the mysql_connect function is not there.
615 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
647 ? S 0:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --
What does: rpm -qa | grep php
result in ?
what files should i check
Could you please give me a checklist of what files and parameters to check?
Re: what files should i check
Run rpm -qa | grep mysqlhardawayd wrote:Could you please give me a checklist of what files and parameters to check?
and check to see if php-mysql-xxxxxx.rpm is installed
(obviously php, mysql and apache must also be installed - check in a similar fashion).
When executing your php script, the apache server and the mysql server must be running - you can check with : ps ax | grep apache
(subsitute mysql)...
You might also wanto run a .php script simply consisting of:
Code: Select all
<?php
phpinfo();
?>Is this what you mean ? Otherwise you must be a bit more specific in your questions - Im a newbie too
compare yours to mine
apache and mysql are running. Also php is working: check my site (below) and please compare the displayed parameters with yours. There has to be a simple problem that is keeping mine from working.
http://donhardaway.com/info.php
Thanks
http://donhardaway.com/info.php
Thanks
Re: compare yours to mine
As far as i can tell you phpinfo is the same as mine. I have enclosed a copy of mine for your perusal.hardawayd wrote:apache and mysql are running. Also php is working: check my site (below) and please compare the displayed parameters with yours. There has to be a simple problem that is keeping mine from working.
http://donhardaway.com/info.php
Thanks
The file I installed, which fixed my troubles is php-mysql-4.2.2-8.0.5.i386.rpm, which I downloaded from rpmfind.net
My phpinfo:
PHP Version 4.2.2
System Linux daffy.perf.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 06:41:59 EDT 2002 i686 i686 i386 GNU/Linux
Build Date Sep 3 2002 05:25:09
Configure Command './configure' '--host=i686-pc-linux-gnu' '--build=i686-pc-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' '--prefix=/usr' '--with-config-file-path=/etc' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2=/usr/sbin/apxs'
Server API Apache 2.0 Filter
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php.ini
Debug Build no
Thread Safety disabled
Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies
PHP 4 Credits
Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference
On On
allow_url_fopen
1 1
always_populate_raw_post_data
0 0
arg_separator.input
& &
arg_separator.output
& &
asp_tags
Off Off
auto_append_file
no value no value
auto_prepend_file
no value no value
browscap
no value no value
default_charset
no value no value
default_mimetype
text/html text/html
define_syslog_variables
Off Off
disable_functions
no value no value
display_errors
On On
display_startup_errors
Off Off
doc_root
no value no value
enable_dl
On On
error_append_string
no value no value
error_log
no value no value
error_prepend_string
no value no value
error_reporting
2039 2039
expose_php
On On
extension_dir
/usr/lib/php4 /usr/lib/php4
file_uploads
1 1
gpc_order
GPC GPC
highlight.bg
#FFFFFF #FFFFFF
highlight.comment
#FF9900 #FF9900
highlight.default
#0000CC #0000CC
highlight.html
#000000 #000000
highlight.keyword
#006600 #006600
highlight.string
#CC0000 #CC0000
html_errors
On On
ignore_user_abort
Off Off
implicit_flush
Off Off
include_path
.:/usr/share/pear .:/usr/share/pear
log_errors
Off Off
magic_quotes_gpc
On On
magic_quotes_runtime
Off Off
magic_quotes_sybase
Off Off
max_execution_time
30 30
memory_limit
8M 8M
open_basedir
no value no value
output_buffering
no value no value
output_handler
no value no value
post_max_size
8M 8M
precision
14 14
register_argc_argv
On On
register_globals
Off Off
safe_mode
Off Off
safe_mode_exec_dir
no value no value
safe_mode_gid
Off Off
safe_mode_include_dir
no value no value
sendmail_from
me@localhost.com me@localhost.com
sendmail_path
/usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
short_open_tag
Off Off
SMTP
localhost localhost
sql.safe_mode
Off Off
track_errors
Off Off
unserialize_callback_func
no value no value
upload_max_filesize
2M 2M
upload_tmp_dir
no value no value
user_dir
no value no value
variables_order
EGPCS EGPCS
xmlrpc_error_number
0 0
xmlrpc_errors
Off Off
y2k_compliance
Off Off
yp
YP Support enabled
xml
XML Support active
XML Namespace Support active
EXPAT Version expat_1.95.4
wddx
WDDX Support enabled
WDDX Session Serializer enabled
standard
Regex Library Bundled library enabled
Dynamic Library Support enabled
Path to sendmail /usr/sbin/sendmail -t -i
Directive Local Value Master Value
assert.active
1 1
assert.bail
0 0
assert.callback
no value no value
assert.quiet_eval
0 0
assert.warning
1 1
safe_mode_allowed_env_vars
PHP_ PHP_
safe_mode_protected_env_vars
LD_LIBRARY_PATH LD_LIBRARY_PATH
url_rewriter.tags
a=href,area=href,frame=src,input=src,form=fakeentry a=href,area=href,frame=src,input=src,form=fakeentry
sockets
Sockets Support enabled
shmop
shmop support enabled
session
Session Support enabled
Directive Local Value Master Value
session.auto_start
Off Off
session.cache_expire
180 180
session.cache_limiter
nocache nocache
session.cookie_domain
no value no value
session.cookie_lifetime
0 0
session.cookie_path
/ /
session.cookie_secure
Off Off
session.entropy_file
no value no value
session.entropy_length
0 0
session.gc_maxlifetime
1440 1440
session.gc_probability
1 1
session.name
PHPSESSID PHPSESSID
session.referer_check
no value no value
session.save_handler
files files
session.save_path
/tmp /tmp
session.serialize_handler
php php
session.use_cookies
On On
session.use_trans_sid
1 1
pspell
PSpell Support enabled
posix
Revision $Revision: 1.42.2.2 $
pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 3.4 22-Aug-2000
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.6b [engine] 9 Jul 2001
iconv
iconv support enabled
Directive Local Value Master Value
iconv.input_encoding
ISO-8859-1 ISO-8859-1
iconv.internal_encoding
ISO-8859-1 ISO-8859-1
iconv.output_encoding
ISO-8859-1 ISO-8859-1
gmp
gmp support enabled
gettext
GetText Support enabled
gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with freetype
JPG Support enabled
PNG Support enabled
WBMP Support enabled
ftp
FTP support enabled
exif
EXIF Support enabled
EXIF Version 1.2
Supported EXIF Version 02100
Supported filetypes JPEG,TIFF
domxml
DOM/XML enabled
libxml Version 2.4.23
HTML Support enabled
XPath Support enabled
XPointer Support enabled
dio
dio support enabled
dbx
dbx support enabled
dbx version 1.0.0
supported databases MySQL
ODBC
PostgreSQL
Microsoft SQL Server
FrontBase
Oracle 8 (not really)
Sybase-CT
dba
DBA support enabled
Supported handlers gdbm db3
curl
CURL support enabled
CURL Information libcurl 7.9.8 (OpenSSL 0.9.6b) (ipv6 enabled)
ctype
ctype functions enabled (experimental)
calendar
Calendar support enabled
bz2
BZip2 Support Enabled
BZip2 Version 1.0.2, 30-Dec-2001
bcmath
BCMath support enabled
zlib
ZLib Support enabled
'zlib:' fopen wrapper enabled
Compiled Version 1.1.4
Linked Version 1.1.4
Directive Local Value Master Value
zlib.output_compression
Off Off
imap
IMAP Support enabled
IMAP c-Client Version 2001
SSL Support enabled
Kerberos Support enabled
ldap
LDAP Support enabled
RCS Version $Id: ldap.c,v 1.116.2.1 2002/04/23 18:59:57 derick Exp $
Total Links 0/unlimited
API Version 2004
Vendor Name OpenLDAP
Vendor Version 20025
mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.52
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient
Directive Local Value Master Value
mysql.allow_persistent
On On
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
Apache 2.0
Additional Modules
sysvshm
sysvsem
Environment
Variable Value
SSH_AGENT_PID 1173
HOSTNAME localhost.localdomain
SHELL /bin/bash
TERM xterm
HISTSIZE 1000
GTK_RC_FILES /etc/gtk/gtkrc:/home/soren/.gtkrc-1.2-gnome2
WINDOWID 33554573
USER soren
LS_COLORS no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
SSH_AUTH_SOCK /tmp/ssh-XXRlZSK7/agent.1131
SESSION_MANAGER local/localhost.localdomain:/tmp/.ICE-unix/1131
MAIL /var/spool/mail/soren
PATH /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
INPUTRC /etc/inputrc
PWD /home/soren
XMODIFIERS @im=none
LANG en_US.UTF-8
GDMSESSION Default
SSH_ASKPASS /usr/libexec/openssh/gnome-ssh-askpass
HOME /root
SHLVL 4
GNOME_DESKTOP_SESSION_ID Default
LOGNAME soren
LESSOPEN |/usr/bin/lesspipe.sh %s
DISPLAY :0
G_BROKEN_FILENAMES 1
COLORTERM gnome-terminal
XAUTHORITY /root/.xauthDVwAKH
_ /sbin/initlog
PHP Variables
Variable Value
_SERVER["UNIQUE_ID"] LzCgWH8AAAEAAAVqBpwAAAAE
_SERVER["HTTP_HOST"] localhost
_SERVER["HTTP_USER_AGENT"] Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
_SERVER["HTTP_ACCEPT"] text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us, en;q=0.50
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate, compress;q=0.9
_SERVER["HTTP_ACCEPT_CHARSET"] ISO-8859-1, utf-8;q=0.66, *;q=0.66
_SERVER["HTTP_KEEP_ALIVE"] 300
_SERVER["HTTP_CONNECTION"] keep-alive
_SERVER["PATH"] /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
_SERVER["SERVER_SIGNATURE"] <address>Apache/2.0.40 Server at localhost Port 80</address>
_SERVER["SERVER_SOFTWARE"] Apache/2.0.40 (Red Hat Linux)
_SERVER["SERVER_NAME"] localhost
_SERVER["SERVER_ADDR"] 127.0.0.1
_SERVER["SERVER_PORT"] 80
_SERVER["REMOTE_ADDR"] 127.0.0.1
_SERVER["DOCUMENT_ROOT"] /var/www/html
_SERVER["SERVER_ADMIN"] root@localhost
_SERVER["SCRIPT_FILENAME"] /var/www/html/test.php
_SERVER["REMOTE_PORT"] 32899
_SERVER["GATEWAY_INTERFACE"] CGI/1.1
_SERVER["SERVER_PROTOCOL"] HTTP/1.1
_SERVER["REQUEST_METHOD"] GET
_SERVER["QUERY_STRING"]
_SERVER["REQUEST_URI"] /test.php
_SERVER["SCRIPT_NAME"] /test.php
_SERVER["PHP_SELF"] /test.php
_SERVER["argv"]
Array
(
)
_SERVER["argc"] 0
_ENV["SSH_AGENT_PID"] 1173
_ENV["HOSTNAME"] localhost.localdomain
_ENV["SHELL"] /bin/bash
_ENV["TERM"] xterm
_ENV["HISTSIZE"] 1000
_ENV["GTK_RC_FILES"] /etc/gtk/gtkrc:/home/soren/.gtkrc-1.2-gnome2
_ENV["WINDOWID"] 33554573
_ENV["USER"] soren
_ENV["LS_COLORS"] no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
_ENV["SSH_AUTH_SOCK"] /tmp/ssh-XXRlZSK7/agent.1131
_ENV["SESSION_MANAGER"] local/localhost.localdomain:/tmp/.ICE-unix/1131
_ENV["MAIL"] /var/spool/mail/soren
_ENV["PATH"] /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
_ENV["INPUTRC"] /etc/inputrc
_ENV["PWD"] /home/soren
_ENV["XMODIFIERS"] @im=none
_ENV["LANG"] en_US.UTF-8
_ENV["GDMSESSION"] Default
_ENV["SSH_ASKPASS"] /usr/libexec/openssh/gnome-ssh-askpass
_ENV["HOME"] /root
_ENV["SHLVL"] 4
_ENV["GNOME_DESKTOP_SESSION_ID"] Default
_ENV["LOGNAME"] soren
_ENV["LESSOPEN"] |/usr/bin/lesspipe.sh %s
_ENV["DISPLAY"] :0
_ENV["G_BROKEN_FILENAMES"] 1
_ENV["COLORTERM"] gnome-terminal
_ENV["XAUTHORITY"] /root/.xauthDVwAKH
_ENV["_"] /sbin/initlog
PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.