Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jul 15, 2010 6:47 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
I've trying to build a simple registration form, I've done it several times, thousands of times, and I've never experienced this mainly because this is the first time that I've set up a LAMP Server. I've been always worked with functional LAMP Servers.

My issue is:
My PHP Code works fine, but as soon as I add a mysql feature like
mysql_connect($hostname,$username,$password) or die(mysql_error());

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.


Top
   
 Post subject:
PostPosted: Thu Jul 15, 2010 6:55 pm 
Offline
Junior Member

Joined: Tue Jul 13, 2010 8:28 pm
Posts: 28
could possibly be something else, but most likely two things are going on:

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 error_reporting or display_errors). Usually these things get turned off in production so as to not reveal that PHP is running. edit you php.ini and refer to http://www.php.net/manual/en/errorfunc. ... lay-errors


Top
   
 Post subject:
PostPosted: Thu Jul 15, 2010 7:24 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
I'm still looking for a possible answer.
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!


Top
   
 Post subject:
PostPosted: Thu Jul 15, 2010 7:32 pm 
Offline
Junior Member

Joined: Tue Jul 13, 2010 8:28 pm
Posts: 28
Assuming you're on a centos/fedora system, it's /sbin/service, so you either add /sbin/ to your path or call it directly from that path. in ubuntu, you'll need to install the sysvconfig package to get it. I'm not familiar enough with other systems, but you should also be able to restart by calling /etc/init.d/apache2 restart (/etc/init.d/httpd for centos/fedora) directly.

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.


Top
   
 Post subject:
PostPosted: Thu Jul 15, 2010 8:01 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
I'm sorry
I'm working with
Red Hat Enterprise Linux 5.


Top
   
 Post subject:
PostPosted: Thu Jul 15, 2010 8:07 pm 
Offline
Junior Member

Joined: Tue Jul 13, 2010 8:28 pm
Posts: 28
you'll want to do a `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.


Top
   
 Post subject:
PostPosted: Mon Jul 19, 2010 1:24 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
Still doesn't work.
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.


Top
   
 Post subject:
PostPosted: Mon Jul 19, 2010 2:35 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
If you're using RHEL 5 just call RH tech support - it is after all why you pay for their distro.


Top
   
 Post subject:
PostPosted: Mon Jul 19, 2010 5:55 pm 
Offline
Junior Member

Joined: Tue Jul 13, 2010 8:28 pm
Posts: 28
Are the pages still blank? If so, please try to figure out the error reporting that I advised you to turn on in my first response. I'd like to see an example of your php code and the related error message. Throw in a phpinfo() output to make me even happier.


Top
   
 Post subject:
PostPosted: Mon Jul 19, 2010 6:10 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
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 whatever_privilige_number mynewfile.php
everytime i want to add a new file.


Top
   
 Post subject:
PostPosted: Mon Jul 19, 2010 10:05 pm 
Offline
Senior Member

Joined: Thu May 21, 2009 3:19 am
Posts: 336
hassamu wrote:
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 whatever_privilige_number 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?


Top
   
 Post subject:
PostPosted: Tue Jul 20, 2010 9:08 pm 
Offline
Senior Newbie

Joined: Fri Jun 18, 2010 1:59 pm
Posts: 12
waldo wrote:
hassamu wrote:
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 whatever_privilige_number 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.


Top
   
 Post subject:
PostPosted: Thu Jul 22, 2010 7:28 pm 
Offline
Senior Newbie

Joined: Thu Jul 15, 2010 6:44 pm
Posts: 6
In other words, I need to change the group that user apache belongs?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group