Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I've been trying to find a solution to this for months, and even on here have previously asked a related question, but no joy so far. More detailed info, where I've also asked this question on StackOverflow is at http://stackoverflow.com/questions/15346605/
The machine in question is running Fedora 15, 64-bit; Apache 2.2.x; MySQL 5.5; PHP 5.3.
Each of MySQL, PHP, and Apache work fine on their own, and PHP with MySQL works fine from the command line, but it won't work with Apache. Anything I try to do with PHP/MySQL with Apache results in "PHP Fatal error: Call to undefined function mysql_connect()" errors in the Apache log.
FYI. There is only one version each of Apache, MySQL and PHP installed on the machine.
php -i (from the command line) shows that PHP is compiled with MySQL support. However, phpinfo() output via a webpage says that it is not compiled with MySQL support ... yet it's the same installation. Each correctly reports itself as using /etc/php.ini for its config.
I've restarted Apache more times than I recall (and also MySQL just in case); and I've also disabled SELinux and tried numerous other things, but all to no avail.
So, right now I'm trying to figure out how come php -i can report PHP as being configured with MySQL, while phpinfo() reports that it is not ... because if I can solve that then I'm sure I'll be on my way to resolving the problem.
FYI. A copy of the php.ini file is at http://pastebin.com/W4Lb1NpP (the lines loading the mysql and pdo extensions, etc, are commented out because the modules are already loaded).
Any assistance would be much appreciated; I seem to have tried everything!
Yep, the modules exist, and are referenced with their full path name in php.ini, and (from the command line at least) PHP warns that they are already loaded anyway. I've tried with the lines in, and with commenting them out. From the command line it works fine with them commented out, but doesn't work either way via a web page.
Yep, there's no problem with MySQL: the machine is a database server and MySQL has worked on the machine for a couple of years with no problem; I use other scripting languages to access MySQL with no problem, and log into MySQL with no problem, and PHP can also use MySQL from the command line anyway.
Yeah, just tried updating all the php bits, and a couple of the modules were updated, but no difference. If I could do a completely new install of Apache and PHP I would do, but a lot of work has already been done with Apache, so I don't really want to mess with it.
However, FYI, I have noticed one difference between the parameters shown by php -i and phpinfo(), and that is the directory to scan for additional .ini files. This may well be relevant.
php -i shows /etc/php.d as the directory (which is correct), and where additional .ini files to load the modules do indeed exist.
However, phpinfo() shows /etc/php-zts.d as the directory, which doesn't even exist. Mind you, the mysql modules, as already discussed, are defined as extensions in php.ini anyway ... but maybe it's not finding other required extensions, which might be causing my issue?
Nonetheless, I cannot find where "/etc/php-zts.d" is being defined. It's not in php.ini, and I'm not sure where else it would be.
I see in /usr/lib64/httpd/modules/:
-rwxr-xr-x. 1 root root 3736368 May 9 2012 libphp5.so
-rwxr-xr-x. 1 root root 3946640 May 9 2012 libphp5-zts.so
Actually, got so fed up with this that I completely removed PHP from the machine, and tried to re-install (i.e. yum install php php-mysql ... etc).
However, even though PHP and associated modules install without any problem, Apache will no longer start once PHP is installed, even though it previously did.
* Restarting httpd (via systemctl): Job failed. See system logs and 'systemctl status' for details.
If I remove PHP again then Apache will start. There's nothing of note in the /var/messages log or systemctl.
So, I'm kind of worse off than I even was before; at least previously PHP was working with Apache, even if PHP with MySQL wasn't working ... but now I can't even get PHP on the machine without Apache failing.
Actually, I'm a little surprised you can re-install that; Fedora 15 is 4 versions out of date & I thought they archived the old stuff immediately.
Are you sure you're getting the correct versions of everything?
TBH though, Fedora is effectively RH's R&D distro; its not designed to be stable and definitely not for prod work, that's why they don't support it.
If you want a RH style free prod OS, go Centos; a free rebuild of RHEL; latest is v6.4 (same as RHEL)