You are not logged in.
I have a small http server on my Arch box to test out a small website I am building. Currently using apache and php. I have mysql installed and running. In addition I have mysql-workbench installed; I am able to enter mysql as both root and user and perform queries.
The web server is working fine as a simple http/php server.
However, NOTHING related to mysql is operating from within php. Even installed phpmyadmin but this also gives a blank page when trying to access.
Here are some relevant details.
apache version 2.2.17-1
php version 5.3.4-2
mysql version 5.1.51-1
The portions of various conf files that I changed are:
/etc/http/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
Include conf/extra/php5_module.conf
....
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
....
Listen 8000
....
DocumentRoot "/home/dwende/srv/http"
....
<Directory "/home/dwende/srv/http">
/etc/php/php.ini
mysql.default_password = my_password_here
...
extension=mysql.so
/etc/mysql/my.cnf
#skip-networking
/etc/hosts.allow
mysqld: ALL : ALLOW
mysqld-max: ALL : ALLOW
sshd: ALL
ALL: ALL
mysqld : 127.0.0.1 : ALLOW
I know that mysql is not working in php from a number of reasons:
1. installed concrete5 and the setup/install screen complains about mysql_connect not being available.
2. I made a small index.php file with the following contents:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
</head>
<body>
<h2>Reached here 1</h2>
<?php
mysql_connect("localhost", "root", "15790306") or die(mysql_error());
echo "Connected to MySQL<br />";
?>
<h2>Reached here 2</h2>
</body>
The page shows only the "Reached here 1" and not the second heading.
Can anyone help please?
Offline
Quick check:
* after changing the php.ini to include the extension, you did restart apache2, right? (# apache2ctl restart)
* did you scour the wiki? I think the LAMP-page holds the most information
Also: it is way easier to check for extensions if you just make 1 page with '<?php phpinfo() ?>'
Last edited by zenlord (2011-01-05 17:43:40)
Offline
Hi Zenlord.
1. using your code snippet as index.php produces a LARGE page with info including the headings "PHP" and "mysqlnd"
2. Did not use "apache2ctl restart" but rather "apachectl restart"
3. I know already that basic php is working since the web pages I am serving include php.
4. The problem (I guess) is only involving mysql
Thanks
Offline
Yes: that LARGE page tells you everything about PHP and it's loaded modules. For some reason the MySQL-module seems not to load (otherwise you should see a block titled 'MySQL' somewhere on that page). Do you see any error in the PHP-logs?
Also: I see in your first post that you have not obfuscated the root-password - please remove that (to obfuscate a password, mark clearly that it is not your password, f.e. '<pword>'.
Last edited by zenlord (2011-01-06 08:11:49)
Offline
SOLVED !!
Thanks zenlord - a quick look at the log showed php could not find some *.so files including mysql.so
The extension_dir in php.ini was for some reason pointing to a non-existent dirextory under /usr/lib/php
I fixed this and now mysql is available within php.
How do I mark the topic as SOLVED?
Offline