PHP, MySQL on IIS - MySQL not being loaded when serving pages - php

I have, as best as I can manage, set up IIS (6.0), PHP (5.2.8) and MySQL (5.1.30) on Windows Server 2003, with all the involved mucking about (I think) in IIS and PHP to get things talking to each other.
PHP does work - however, I cannot use the mysql or mysqli libraries from a PHP page.
Fatal error: Class 'mysqli' not found in...
Fatal error: Call to undefined function mysql_connect() in...
Information relating to MySQL or MySQLi does not appear when using phpinfo() in a PHP page.
However, when I invoke PHP from the command line, such as
> php -r phpinfo()
Information relating to MySQL and MySQLi does appear in the output from that.
Restarting IIS or the OS does not produce further effect. I have only one php.ini file, in the PHP root directory.
Do I need to connect MySQL to IIS somehow as well, or is there another problem?

The php.ini file used for command-line usage of PHP may be different from the php.ini used by the web server. You should get phpinfo() information by putting a small PHP script under your web server's document space:
<?php
phpinfo();
?>
Open this PHP script by using your browser to request that PHP script via an URL to your web server. That will tell you what the web server thinks is your PHP configuration.
Also remember that you need to restart the web server for edits to php.ini to take effect. It only reads the php.ini when the web server starts.
There are numerous places the php.ini file that your IIS instance is using might live. See http://php.net/manual/en/configuration.php or http://www.iis-aid.com/articles/how_to_guides/where_php_ini_is_loaded_from for details.
Look at the output of phpinfo() when viewed in your browser, and look for the item "Loaded Configuration File".

Related

Bitnami unable to enable Curl

i AM USING A aws lightsail instance with a Bitnami Apache2 Lampstack setup on it.
My issue is I am unable to get php curl enabled. I seem to have a bunch of php.ini files all over the server in diffiferent locations. So I edited all of them removing the ; from the line that read extension=curl. I then restarted the instance. However my php file is still giving me the error saying
caught Exception: Shippo needs the CURL PHP extension.
When I run a phpinfo() I see my path to the ini file is /etc/php/8.0/apache2/php.ini
However when I do a which php command I am giving a path like this /opt/bitnami/php/bin/php
when I do a php -v I am also seeing it say PHP 7.4.27 so my php info file seems to say I am using php7.8 and my CLI feels i am using php7.4 which could be part of my issue.
Any suggestions on how to fix this? my other issue is I am having a hard time getting to the path /etc/php/8.0/apache2/php.ini I simply can not find a folder with 8.0 in it

PHP oci_connect() is working on terminal/Centos server but not on browser

I am getting error when I trying from browser.
Warning: oci_connect(): ORA-28759: failure to open file in
/var/www/myapp/abc.php on line 16
Fatal error: ORA-28759: failure to open file in /var/www/myapp/abc.php on
line 19
But when running same file from Server terminal as a root user > PHP abc.php that time oracle database output is coming.
I didn't understand why is running from terminal but not on browser.
I am using PHP7, Apache and Installed Oracle 19c home db.
I am using oci_connect to communication with oracle database from PHP code.
I think there is some permission issue to my httpd (apahce).
Please give suggestion.
Check that the web server process has access to all the Oracle client libraries and data files. Since you are using an Oracle home, make sure all the directories have 'other' access permissions set. Typically user home directories don't have this by default.
Since the app is running, some libraries are being loaded so maybe permissions are OK? Make sure you have the web server process environment variables the same as those used by your command shell to make sure the same set of Oracle client libraries are being used. (Do you also have Instant Client installed somewhere, or another Oracle home??).
The recent common causes of 'ORA-28759: failure to open file' are when Oracle cloud wallets are being used and the sqlnet.ora path to the wallet (the DIRECTORY=... bit) is not valid. ​Check the path is OK, or the Oracle Net configuration files are in the default location (and are readable). Note that with Instant Client 19.14 you can use 1-way TLS so wallets are not always needed, depending on your net configuration.
I doubt there is a problem with php.ini, since you are obviously able to call OCI8 functions. The php.ini file doesn't control behaviors of the Oracle Client libraries that are throwing the error.
Update your question with more details about how you are setting the environment and what Oracle configuration files are being used for connecting

undefined function mysqli_connect() through url

I used to use Centos 7.2.1511, Apache 2.4.6, MariaDB5.5.52 and php 5.4 as my web server. But recently I updated php to 7.1.7. So I can't use functions like "mysql_connect()" anymore.
After I replaced them with "mysqli_connect()", I met a problem. I can execute the php file directly in the server successfully. But when I do it through the url, I get the error: Call to undefined function mysqli_connect().
Why did that happen? Is there something wrong with my Apache?
the command line version of php is not necessarily the same as the one used through apache.
(could still be on php 5.4)
But even if it was updated as well: you could have an other php.ini in both situation.
<?php phpinfo(); ?>
should reveal what php.ini is found and loaded
See if this helps: https://serverfault.com/questions/428800/how-do-i-tell-apache-which-php-to-use .
In my case the 'libphp5.so' file is located in
/etc/httpd/modules -> ../../usr/lib64/httpd/modules
You might have to copy the new files to this location or create symbolic links to the new files.

WAMP Call to undefined function socket_create() even though enabled in both php.ini files

I have read numerous posts regarding enabling sockets on WAMP.
I have uncommented the extensions from both php.ini files that exist, and also checked that it is indeed enabled by left clicking wamp icon > PHP > PHP Extensions and making sure that php_sockets is checked ( and it is ).
Also if I view load phpinfo in my browser I see that web sockets is enabled.
However, when I try to execute a script from the command line, I get the following error:
PHP Fatal error: Call to undefined function socket_create() in /cygdrive/c/wamp/www/chat/websockets.php on line 20
Also, I read somewhere that I should see web sockets in the list if I do the following in the command line: php -me, however when I do that I DO NOT see sockets in the list, I guess this might be the problem but don't know what to do about it, since I have enabled everything I found.

PHP log full of suhosin errors

Hello I have simple php script well it is more a html file with few php lines.
Yet it produces tons of errors in log that look like this on every line:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/suhosin.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0
I can not locate in nowhere in code where suhosin might been called...
This error is present on 2 different servers.
EDIT:
In phpinfo there is no suhosin present...
Thanks.
We will likely need more information in order to provide an accurate resolution, such as What version of PHP is installed on your system? however I will give you a general resolution.
Generally this issue is caused by PHP Upgrade, most recent PHP versions does not support suhosin as this only applied to older versions of php that needed additional security.
If you are on a shared hosting server you need to contact to your hosting provider and notify them about this issue, they are likely able to resolve it quickly.
If you are on a Dedicated server, VPS server or a localhost environment you can solve this issue by following the steps below:
Find your php.ini location [You can use phpinfo() to locate php.ini file]
Open the php.ini file and search suhosin.so
When you find suhosin comment this line extension = "suhosin.so" by adding semicolon at the beginning of the line, For example: ;extension = "suhosin.so"
Save this file
Restart Apache service httpd restart
Note: If ClouldLinux installed on your server, you need to force update CageFS by issuing the following command at the command line cagefsctl --force-update

Categories