Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 5th, 2012, 10:16 PM
dobs dobs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 8 dobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 36 sec
Reputation Power: 0
Mysql_connect failure

Hi. Up until this point I have had mysql, php, and apache up and running just fine. Recently I made a little change. I configured Apache to read my .php pages from /home/user/code/php instead of /srv/http. It wasn't working originally so I created a new http user using this command:

Code:
useradd -d /srv/http -r -s /bin/false -U http

And replaced /srv/http with the directory of my choice. Almost everything went fine. I was able to see all my .php files. The problem was with one file. This is the code for it:

Code:
<?php
mysql_connect("localhost", "root", "mypass") or die(mysql_error());
echo "Connected to MySQL<br />";
?>

Originally it displayed everything fine but once I made the switch it displayed this error:

Code:
 Fatal error: Call to undefined function mysql_connect() in /home/'user'/code/php/connect.php on line 2


I tried to login to phpMyAdmin as well and this error is displayed:

Code:
The mysqli extension is missing. Please check your PHP configuration. <a href="Documentation.html#faqmysql" target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation" class="icon ic_b_help" /></a>


Not sure if it matters but I have made the switch to a systemd only installation and have run systemctl enable httpd.service, systemctl enable mysqld.service, systemctl start httpd.service, and systemctl start mysql.service countless times just to be sure. I have also made sure that

Code:
extension=mysqli.so
extension=mysql.so


Are both uncommented in /etc/php/php.ini

Reply With Quote
  #2  
Old November 5th, 2012, 10:21 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,690 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 3 h 43 m 47 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Use phpinfo() to see which php.ini is being parsed. Also check error logs for messages from PHP - maybe about being unable to load extensions.

Reply With Quote
  #3  
Old November 5th, 2012, 10:33 PM
dobs dobs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 8 dobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 36 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
Use phpinfo() to see which php.ini is being parsed. Also check error logs for messages from PHP - maybe about being unable to load extensions.


I'm sorry, I'm pretty new to LAMP. But here's what I'm thinking you want me to look at:

(oops, didn't realize I couldn't do that)

Anyway, It says that there are no additional .ini files parsed besides php.ini. There are no files in conf.d..

Reply With Quote
  #4  
Old November 6th, 2012, 12:53 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,690 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 3 h 43 m 47 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
You can post URLs, just don't make them look like URLs

What phpinfo() will tell you is the exact location of the php.ini it's using. That's where you need to make sure the extension= lines are.
Also, with Apache you need to restart it when you make php.ini changes (or other significant changes). Settings won't take effect until you do.

As for errors, check Apache's error log. And maybe some of the other /var/log files.

Reply With Quote
  #5  
Old November 6th, 2012, 01:57 PM
dobs dobs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 8 dobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 36 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
You can post URLs, just don't make them look like URLs

What phpinfo() will tell you is the exact location of the php.ini it's using. That's where you need to make sure the extension= lines are.
Also, with Apache you need to restart it when you make php.ini changes (or other significant changes). Settings won't take effect until you do.

As for errors, check Apache's error log. And maybe some of the other /var/log files.


Ah I see:

ht tp://i.imgur.com/O1iKN.png

I'm hoping that is the relevant part of phpinfo(). Also, I'm not sure if this is relevant but:

Code:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "/usr/lib/php/modules/"
; On windows:
; extension_dir = "ext"

Reply With Quote
  #6  
Old November 6th, 2012, 02:42 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,690 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 3 h 43 m 47 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Then you're editing the right file. Make sure you're restarting Apache after you make php.ini changes and check its logs (/var/log/apache* probably) for errors.

Reply With Quote
  #7  
Old November 6th, 2012, 05:12 PM
dobs dobs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 8 dobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 36 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
Then you're editing the right file. Make sure you're restarting Apache after you make php.ini changes and check its logs (/var/log/apache* probably) for errors.


I've restarted relentlessly...I will check phpinfo() more. It obviously has something to do with the fact that I temporarily changed the Document_root for user http.

EDIT: I don't suppose I could do something so simple as reinstalling could I?

UPDATE: Fixed the errors. It was a simple random syntax error in the /etc/php/php.ini file. Found it after running php -m. I can't believe I didn't try that sooner. *facepalm*

The only trouble now is that I can't get php to display any errors. I definitely have it enable in /etc/php/php.ini:

Code:
 error_reporting
   error_reporting E_ERROR  E_WARNING  E_PARSE
   Default Value: E_ALL E_NOTICE E_STRICT E_DEPRECATED
   Development Value: E_ALL
   Production Value: E_ALL E_DEPRECATED E_STRICT

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mysql_connect failure

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap