Issues with my LAMP Server
My issue is:
My PHP Code works fine, but as soon as I add a mysql feature like
mysqlconnect($hostname,$username,$password) or die(mysqlerror());
My page appears blank, completely blank, It doesn't matter where do I type that code, it appears blank.
I'm frustrated, I've been trying to fix that a lot of times and I can't.
somebody has an idea what could be happening?
Thanks.
12 Replies
1) the php-mysql wrapper isn't installed (how to do so depends on your os)
2) php error reporting is turned to silent (could be mixture of errorreporting or displayerrors). Usually these things get turned off in production so as to not reveal that PHP is running. edit you php.ini and refer to
I've seen that i need to configure PHP5 by myself towork with MySQL.
So I went to php.ini and I added the line
extensions = mysql.so
but then I ran the command
locate mysql.so and It's nowhere in my computer.
The things is I didn't set up this server, it was someone else and I think it was a unexperienced linux user, I've been working with these guys 2 days I've seen how they work, probably they screwed up the whole thing, and now I need to fix it in order to finish my job.
I'm trying to run service httpd restart, but I can't!
Like I said, you probably don't have mysql.so because you don't have the php-mysql package. unless you reveal which OS and version you have, I can't really point you to the right direction.
I'm working with
Red Hat Enterprise Linux 5.
yum install php-mysql
. You might want to remove the extension=mysql.so from your php.ini because the package should automatically add entries into /etc/php.d/ from which they get autoloaded.
I already typed yum install php-mysql
I delete the old httpd, and Installed the new one using yum,
yum install httpd php mysql-server mysql php-mysql
it installed everything, but i'm still unable to run mysql_ commands in php.
Is there a way to automatically give the right permissions to all files in /var/www/html/ ??
I have to go to the terminal and type
CHMOD whateverpriviligenumber mynewfile.php
everytime i want to add a new file.
@hassamu:
Now it works, I figured it out after a while it was a problem concerning priviliges, so CHMOD solved it.
Is there a way to automatically give the right permissions to all files in /var/www/html/ ??
I have to go to the terminal and type
CHMOD whateverpriviligenumber mynewfile.php
everytime i want to add a new file.
chmod to what? Apache should only need read access to your php files. How does your site function if your web server can't read your files?
@waldo:
@hassamu:Now it works, I figured it out after a while it was a problem concerning priviliges, so CHMOD solved it.
Is there a way to automatically give the right permissions to all files in /var/www/html/ ??
I have to go to the terminal and type
CHMOD whateverpriviligenumber mynewfile.php
everytime i want to add a new file.
chmod to what? Apache should only need read access to your php files. How does your site function if your web server can't read your files?
It could be that the webserver is run by another user that doesnt belong in the group that has permissions for alread-properly chmodded files. It's a mistake I see often when people install a ton of packages and then start modifying webservers, sudo, etc.