oci_connect Blank Page in PHP - php

UPDATE (5/21/2010) SUCCESS!
So after MUCH $head->desk()'ing, I've solved it.
Remember kids, be wary of the instant client version you use, dependent on the virtualization settings!
I had been installing the generic Instant Client (not aware our ESX servers sit on AMD processors, not Intel) and that worked fine internally (the CentOS install was 32-bit since our internal ESXi servers aren't 64-bit). Well lo-and-behold, even if you have a 32-bit install running on a virtualized server which is sitting on an AMD64, it still matters what instant client you install.
It was the last thing I thought to check but as it appears, everything is running fine now.
I would like to thank everyone who helped me run through every possible test to figure this out but in the end, it was my fault for not realizing the differences in the virtualizations.
UPDATE (5/21/2010)
I thought this bug had escaped me when I installed it on a new VM internally but I have now found a narrowing link.
I was trying to install this on our production server when I posted this. After a week of no progress and in need to get back to development, I outfitted a VM on our internal server with a brand new install of Crap... CentOS, and fresh installs of instant client and oci8.
Worked perfectly.
However we just uploaded an exact copy of the VM to our production servers and it magically no longer works. Tried reinstalling everything, no avail.
So the only things I could narrow it down to is a firewall issue (although I get the same issue when trying 127.0.0.1) or possibly an ESX (our production servers) server issue, internal servers are running ESXi.
Any thoughts?
UPDATE (3/8/2010) I installed Xdebug and have it tracing my code. This is the output I am getting:
TRACE START [2010-03-08 17:53:05]
0.2090 327864 -> {main}() /data/aims3/http/octest.php:0
0.2091 327988 -> ini_set(string(14), string(1)) /data/aims3/http/octest.php:3
0.2093 327920 -> error_reporting(long) /data/aims3/http/octest.php:4
0.2094 328048 -> oci_connect(string(8), string(8), string(25)) /data/aims3/http/octest.php:6
The trace halts at that point.
I have installed everything the same way on a local server and it works fine. To say I am at a complete loss would be putting it lightly.
*NOTE: I ran make test and it returned FAIL on every test. I never ran this on my working machine to see if it reports the same errors. Any idea why make test would report FAIL but make doesn't report any error?
I've installed the Oracle Instantclient with no reported errors along with the OCI8 PECL package and at a loss. Whenever I try to open a connection with oci_connect, it halts my entire PHP script.
EXAMPLE:
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
$conn = oci_connect("username", "password", "host");
echo "after";
?>
Returns a complete blank page. The module is loaded (seen in phpinfo) and everything installed with no errors.
I am at a complete loss.
CentOS: 5.4
Apache: 2.2.3
PHP: 5.3.1
InstantClient: 11.2
oci8: 1.4.1
Any thoughts?
NOTES
Apache Error Log reports nothing
Attempted Debugging:
1:
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');
echo "after";
?>
Returns:
beforeafter
2:
Changing host to //host
Returns:
Same error

Is there anything in Apache's error_log? Is this mod_php or FastCGI or normal CGI PHP? What happens if you run the script via the command line?
You could also try setting PHP's error log and looking in there.
EDIT1: Try:
echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');
And post the results...
EDIT2: I'm really not sure. My best bet is this info from the PHP manual:
The most common problem with
installing OCI8 is not having the
Oracle environment correctly set. This
typically appears as a problem using
oci_connect() or oci_pconnect(). The
error may be a PHP error such as Call
to undefined function oci_connect(),
an Oracle error such as ORA-12705, or
even an Apache crash. Check the Apache
log files for startup errors and see
the sections above to resolve this
problem.
Anyone else have any ideas to help out Bryan?

Bryan,
I am going to be honest: I tried this two years ago and failed miserably. :) I could not get the OCI functions to work for anything by compiling myself.
But in the interest of getting it done I looked for an alternate solution and found it in Zend Core for Oracle. All I did was download, run the installer, and it was done. It installs Apache/PHP, MySQL (optional), and the InstantClient for you.
Now as Zend Server, it is basically the same product. I realize that this may not be the solution you hoped for, but if it works...
Zend Server

are you connecting to remote or to local db? i think, for localhost you must replace "host" with "false". I hope, this will help you...
edit: i think, you are missing a parameter...my last suggestions are: 1. you must set the port (default 1521) AND/OR 2. You must enter db name AND/OR you must set the instance name (the ORACLE_SID parameter)

You never check the return value of oci_connect() or call oci_error() but it doesn't look relevant to your problem since you seem to be suffering from a PHP crash. There's an open bug for RHEL that may affect you too:
http://pecl.php.net/bugs/bug.php?id=16626
Did you build the oci8 package yourself? Are you using a third-party binary?

It has been fixed. See the top for details but here is the cliff notes: virtualiztion environments matter.

Related

SQL server extension not working in PHP v7.4.8

So I was updating our web servers (Windows 2012 R2/IIS) with the newest version of PHP this morning (version 7.4.8 from 7.4.6, because I was slacking 2 weeks ago).
In our setup, we include the dll from Microsoft (php_pdo_sqlsrv_74_nts.dll) in the ext folder as we have some sites running some PDO lookups to some backend SQL servers. After I registered the new version, I started getting errors in those PDO calls (PDO is loading), but I'm getting cannot find driver. As soon as I switch back over to 7.4.6, everything loads.
I didn't see a newer file provided from Microsoft yet. Is anyone else seeing this behavior or have a fix for it yet?
Thanks,
Since I had more then one php version installation.I had to specify the specific extension folder in my php7.4.8 ini file. i.e.extension_dir = "C:/php7.4/ext"
Everything worked fine after that
Since there could be multiple PHP version side-by-side.
1.Please ensure your IIS PHP-CGI handler is pointing to the right version.
2.Please ensure you have copy the dll to the right ext folder
3.Please ensure you have set the correct extension_dir
4.Please ensure you have registered the extension=..... correctly.
5.Please do an IISRESET when you finish updating the configuration.
You can try to double click php-cgi.exe to check the real exception. If everything is set correctly, there might be some compatibility issue.
Have you tried to double click php-cgi.exe to check the real
exception? If there is a issue, there should be an error message. Have
you encountered any error message?
No error after double clicking php-cgi.exe
So this was eventually fixed in the release of 7.4.10. It was a little known error it seems, but they got it fixed.

blackfire config issue with php probe

So I'm trying to install "Blackfire" from Sensiolab and following all the instructions et.. I'm facing an issue when lauching it to profile my app and also for any related php cli that I'm running...:
The error message is:
“Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20160303/blackfire.so’” => faire enough, there is no blackfire.so in that directory...
The I checked my blackfire.ini and the config seems fien referencing the path where blackfire.so is actually stored:
[blackfire]
extension="/usr/local/Cellar/blackfire-php71-zts/1.23.1/blackfire.so"
I also tried to add some config to php.ini and when I run phpinfo() nothing has been updated...:
[blackfire]
extension=blackfire.so
; On Windows use the following configuration:
; extension=php_blackfire.dll
; Sets the socket where the agent is listening.
; Possible value can be a unix socket or a TCP address.
; Defaults to unix:///var/run/blackfire/agent.sock on Linux,
; unix:///usr/local/var/run/blackfire-agent.sock ;on MacOSX,
; and to tcp://127.0.0.1:8307 on Windows.
;blackfire.agent_socket = unix:///var/run/blackfire/agent.sock
blackfire.agent_timeout = 0.25
Thanks in advance for your help guys
Well actually I resolved the issue by:
Getting rid of MAMP stack as the php version installed with Homebrew was conflicting with the MAMP version and I honesty couldn't figure out which php.ini was used eventually even using the related command... it was showing the homerew one but I had the feeling that this was causing me issues...
I uninstalled balckfire and installed it again (no more MAMP) and of course PHP with Homebrew and it worked fine... just a little set up issue that I had fixed doing the below
changing the default setting in the blackfire.ini
this was defaulted socket=tcp://127.0.0.1:8307 while I have a unix/OSx and the following should have been defaulted instead unix:///usr/local/var/run/blackfire-agent.sock
Hope this will help someone in the same situation

Apache in MAMP Pro 4 has stopped working, refuses to start

Have been using MAMP Pro for a fair while - version 3 primarily, upgraded to 4 a while ago.
I haven't had any unusual issues at all, but today the Apache service failed to start, telling me to check the error logs. The logs were blank unfortunately... I've made no system configuration changes, no changes to MAMP/MAMP Pro. Shut down my system yesterday, started today, it no longer works...
I've tried numerous suggestions found via Stack Overflow and Google without any success.
Even after completely uninstalling and re-installing MAMP Pro I am unable to get the service to start.
Nothing appears in the logs...
When starting it manually on the command line it comes up with a PHP related error:
$ Applications/MAMP/bin/apache2/bin/apachectl start
httpd: Syntax error on line 135 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so into server: dlopen(/Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so, 10): image not found
The confusing thing is that I don't have PHP 5.2.17 specified anywhere, at all - according to MAMP Pro it should be using PHP 7.0.12.
If I add PHP 5.2.17 to MAMP using the appropriate MAMP Pro dialogs, Apache still fails to start via the MAMP Pro interface. I can now start it manually from the command line however, but none of my virtual hosts/etc seem to be loaded.
apachectl -V tells me it's using /Applications/MAMP/conf/apache/httpd.conf, but there is nothing in that file that has any reference to any of the configs generated in /Library/Application Support/appsolute/MAMP PRO/conf
It also looks like hosts entries aren't added to /etc/hosts.
Even if I tell /Applications/MAMP/conf/apache/httpd.conf to do nothing but include /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf (and manually add entries to /etc/hosts) it still doesn't seem to work at all...
I and my colleagues are at a complete loss, especially given it was working yesterday...
Has anyone had any issues like this?
I managed to fix the similar issue you had.
My Apache server was working fine and then following updating to 4.0.6 I experienced similar issues.
There were 2 things I did to fix the issue. I was getting the same error where it couldn't find a php file in 5.2.17. After fixing that by adding 5.2.17 to MAMP I experienced an apache error regarding user permissions.
(22)Invalid argument: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
File > Edit Template > Revert ALL Templates to Default Settings.
Save & restarted the servers and all worked finally and all my hosts had retained as well.
I had previously entered a custom line in my httpd.conf file that for countless versions had copied across fine however it looks like the folder structure had changed and so couldn't locate it causing the unusual error about User permissions. I have since re-entered the custom line with the correct structure and all working fine again.
Hope this helps.

Cannot Start Wamp Server

For some unknown reason I cannot start WAMP server - The icon stays yellow no matter what:
Checked port 80, and it's not used.
No Skype, no Firewall.
Tried MANY solutions I suggested here in stackoverflow - absolutely nothing.
Tried to uninstall and reinstall - it worked for 10 minutes, then it didn't work again.
The only thing I'm changing is to include Virtual Hosts under httpd.conf. Checked every solution I could find on the net - nothing is working for me.
Maybe, just maybe it's because I previously installed PHP 5.5 apart from WAMP? If I go to PHP > PHP Extensions > then I can see there's a problem in php_opcache and php_enchant. When I click on them I get an error message that says: Could not execute menu item (internal error). [Execption] Could not perform service action: the service has not been started. The PHP Version I installed is 5.5.15. The PHP WAMP is 5.5.12... I don't have a clue how to uninstall PHP, and I couldn't find anything about that on the net.
PHP Error log says: PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_intl.dll' - %1 is not a valid Win32 application. in Unknown on line 0
EDIT - It seems like the cause for the problem is me trying to include Virtual Host via httpd.conf file. When I excluded, like in default, WAMP is online again. Any suggestion of how to include virtual host and still get WAMP get online?
It looks like you're running on a corrupt install have you tried reinstalling the software?
Alternatively i would recommend using Xampp which basically offers the same service as Wampp only with a bit more ease of access (also allowing for Mecury mail service and an FTP server for remote access).
The problem with php_intl can be corrected easily, see this answer
In order to find out what Apache is complaining about with the Virtual Hosts definition look at the Windows Event Log or, launch a command window and
cd \wamp\bin\apache\apachex.y.z\bin
httpd -t
This should give you filename and line number where your errors are.
Try changing that port number anyway. Mine stays yellow if the port number is set to 80, even though WAMP says it's not being used by any other program.

PHP error handling has disappeared since upgrading to mountain lion

I recently installed mountain lion, and when I went to start apache from XAMPP I got an error requesting I disabling web sharing in order for XAMPP to work. After some research I found a command which would turn of the apache that comes bundled with mountain lion. This worked and apache from XAMPP started.
However the next thing I have noticed is im no longer getting error handling.
Im using fuelphp, however instead of an error message when there are issues with my code I get a blank page with the words NO DATA RECEIVED :S.
For example removing a ; from the end of line, results in the above opposed to a readble error message.
I checked the frameworks index.php file which has error reporitng on
error_reporting(E_ALL);
ini_set('display_errors', 1);
Could any one give me a step by step explanation of how to get my error reporting back :'(
I have the same problem on Max OS X too. It's definitely a server configuration issue as exactly the same code works perfectly well on Windows and multiple Linux environments.
My Apache/PHP was installed on the Mac through XAMPP. Others who are suffering from the same issue, please let me know in the comments if you too are using XAMPP. I want to track down the exact server config that is causing this problem.
For now, I have a hacky workaround:
In fuel/core/bootstrap.php, add this to the top of your register_shutdown_function
$last_error = error_get_last();
if (is_array($last_error) && \Fuel::$env == \Fuel::DEVELOPMENT && in_array($last_error['type'], array(4, 1, 256, 64))) {
exit();
}
Weird thing is though, it's hit and miss as to whether it catches the error. So I sometimes have to refresh a few times.
Oh and you must set the environment to DEVELOPMENT. This is to stop leaking errors in production deployed sites.
EDIT:: It seems that MAMP (latest version 2.1.2 at time of writing) does not suffer from this issue. Neither does XAMPP 1.8.1-beta1. So you could also try using those.

Categories