I'm trying to get a PHP site working in IIS on Windows Server with MySQL.
I'm getting this error…
Fatal error: Call to undefined function mysql_connect() in C:\inetpub...\adodb\drivers\adodb-mysql.inc.php on line 363
Update…
This link outlines the steps I followed to install PHP on my server:
How do I get PHP and MySQL working on IIS 7.0 ?
(note especially steps 6 and 8 regarting php.ini and php_mysql.dll).
Only two lines in the phpinfo report reference SQL:
<?php
phpinfo();
?>
Configure Command:
cscript /nologo configure.js "--enable-snapshot-build" "--enable-mysqlnd"
sql.safe_mode:
Local Value Off, Master Value Off
PHP Configure Command http://img79.imageshack.us/img79/2373/configurecommandmw8.gif
PHP sql.safe_mode http://img49.imageshack.us/img49/3066/sqlsafemoderu6.gif
Update…
I found the solution: How do I install MySQL modules within PHP?
Check out phpinfo to see if the mysql functions are compiled with your PHP
<?php
phpinfo();
?>
Since in some versions of php, its not default with the install.
Edit for the Update:
You should have a full MySQL category in your phpinfo();
See this for example: https://secure18.easycgi.com/phpinfo.php (googled example)
It sounds like the version of PHP you are using has not been compiled with MySQL support, or has not been enabled in the php.ini.
Looks like you haven't got the MySQL PHP extensions installed! You shouldn't have to do any configuration other than installing the correct modules (and shouldn't be doing anything with ADODB).
PHP comes in 2 versions as well - a CGI version and an ISAPI module. You're best using the ISAPI version with ISS and adding all the trimmings...
I found the solution: How do I install MySQL modules within PHP?
Related
Initial Situation:
I have an Ubuntu 12.04 Server hosting 3 Websites (with Apache 2.2.22)
How can I install a different PHP version for only one of the Websites?
(The other 2 should remain as they are)
Current PHP Version: PHP 5.3.10
Desired PHP Version: PHP 5.6.16
What i have done/understood until now:
I have already tried out PHPBrew:
http://phpbrew.github.io/phpbrew/
I managed to install PHP 5.6.16 for the command line (with PHPBrew) but the Apache still uses PHP 5.3.10.
I understood that i should end up with an *.so file which i need to place in /etc/apache2/httpd.conf file. (this file is empty at the moment)
(via LoadModule...)
But: I don't have any *.so files.
I installed PHPBrew like this:
phpbrew install 5.6.16 +default +mysql +mcrypt
I think I should have added +apxs2=/usr/bin/apxs2 but if I do this i get the error "Exception: apxs binary is not executable: /usr/bin/apxs2".
How can i fix this?
Or is there a better way to run different PHP versions on one Server?
What is the best way?
Double check the .so files, they should be in `/usr/lib/apache2/modules/``
Then you should edit your /etc/apache2/mods-enabled/php5.load and specify the .so file that corresponds to your installation, in your case:
LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.16.so
An alternative solution for running multiple PHP versions on the same box is using Docker, see my answer in another thread: Multiple PHP versions on the same box
Note that with this solution different PHP versions will be available on different ports.
I am working on a Windows 7(x64) with Apache 2.4 x86, Php54 x86
and MySql 5.6 x64.
PHP is working well on my Apache Web Server.
When i run PHP from CommandLine : php dbTest.php it runs without problems
but when i try to load my page, i get the error Fatal error: Call to undefined function mysqli_connect() in <path to dbtest.php> on line 3
tried installing PHP 55 but nothin...
Tried putting libmysql.dll in (php dir, win/system32, apache bin)
installed VC71 runtimes (because i saw it in a troubleshooting guide)
Edit:
- also tried installing all x64 (Apache and PHP)
- tried to install Apache v2.2 and PHP v5.3,
Nothing works...
how come running the command-line works but through Apache, it isn't working?
i see mysqlnd listed, but not mysql/mysqli, as if mysqlnd was the module...
Thank you for your time.
and for saving me the last few hair i have!
PHP 5.4 comes with mysqlnd installed by default so you shouldn't need libmysqli.dll
Does phpinfo() list a mysqli block?
You need this file in ext directory php_mysqli.dll
This question already has answers here:
How do I get the SQLSRV extension to work with PHP, since MSSQL is deprecated?
(3 answers)
Closed 3 years ago.
I'm trying to run mssql driver for PHP, but something goes wrong.
I managed to get the right drivers for mssql, then added the extensions in php.ini, but PHP is still running "--without-mssql" "--without-pdo-mssql".
I'm running PHP 5.4 under Apache 2.2 on Windows XP SP3.
How to start the mssql drivers?
I've just had the same problem, for me I needed to use a different version of the driver.
I was using:
extension=php_sqlsrv_53_ts.dll
Which gave me the following error in PHP:
[28-Nov-2013 10:58:47 UTC] PHP Warning: PHP Startup: sqlsrv: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API
The solution:
extension=php_sqlsrv_54_ts.dll
Download from: http://www.microsoft.com/en-us/download/details.aspx?id=20098
See this answer: https://stackoverflow.com/a/25199324/1847383. If you use PHP as an Apache module, use the thread safe version.
I have found a great tutorial and explanation on this website:
http://bendustries.co/wp/setting-up-xampp-to-work-with-mssql/
All you need to do is download from here :
https://www.microsoft.com/en-us/download/details.aspx?id=20098
two files called:
php_pdo_sqlsrv.dll
php_pdo_sqlsrv.dll
And place then inside the php\ext folder.
Then you need to add those two lines under "Dynamic Extensions"
extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll
Save your php.ini file and restart apache, This process worked for me on win7 after I tried several other methods !
I am trying to connect MSSQL to PHP. i am following this tutorial. Anyway after i added the dll files as described in that tutorial, i get the following warning. How can i solve this ?
php starup sqlsrv unable to initialize module module compiled with module api=20090626 php compiled with module api=20020520 these options need to match
note:i have gone through this post but none helped.
Looks like you've tried to install the sqlsrv extension for php 5.3 on a php 5.2 system.
Either run <?php phpinfo(); ?> and look for the php version and look for the following entries:
PHP Version
Thread Safety
pick the appropriate .dll from the sqlsrv driver: the version number must match and if thread safety is enabled pick the ts version, if not pick the nts version.
For anyone trying to get it to work with PHP 5.5 (PHP compiled with module API=20121212) then you can replace the dlls in the ext folder with new updated binaries >here<
Don't forget to enable the new dlls in the php configuration.
In my case the issue was with multiple php version under an Apache. The php cli loaded another php version's php.ini. The takeaway is: always check the configuration before you dig deeper into the problem.
I need the MongoDB PHP driver on my CentOS 5.4 machine. My PHP version is 5.1.6. I downloaded the RPM and installed it. That created several files in /usr/bin directory. I copied
/usr/bin/mongo
to
/usr/lib/php/modules
which was what extension_dir showed on doing phpinfo();.
I also added
extension=mongo.so
in /etc/php.ini.
However on executing my PHP script, i still get
Mongo class not found.
What's going wrong here ?
Also, my phpinfo() shows PHP version 5.1.6 whereas running PHP from command line shows 5.3.3. Could anything be wrong with that ?
Thanks in advance.
You're saying your webserver and command line PHP report different versions. These are going to be installed in different locations, and their extensions are API incompatible with each other.
When you installed the php_mongo extension, it may have used the command line php to determine the directory to install the extension to.
Make sure you have the correct php_mongo for the php version of your webserver, and it is in the correct extensions directory. (get the directory from the php.ini returned by phpinfo())
I hope you realise PHP 5.1 is also many years out of date. Unless you have a specific reason to use a version that old, you should also look at upgrading to a more recent version.
Edit:
Just read your comment "I must also mention that /usr/bin/mongo is a binary executable file but its not having a .so extension. Im copying it as is to /usr/lib/php/modules"
No no no! :)
This is the mongo command line client. This is not the PHP extension!
You can run a find /* -name "mongo.so" to see where the installer put the file, this will probably also give you an indication of which version of PHP it was installed for.
It looks as though you are confusing the RPM-packages for the MongoDB server with the requirements to install the MongoDB PHP driver. The PHP driver provides access to the server from your PHP applications, and does not install any command line tools.
restart httpd !
yum service httpd restart