PHP in MacOS Catalina throwing SIGILL when using PDO with SSL - php

I'm on MacOS 10.15.1 (19B88). PHP scripts that connect to MySQL over SSL were working before the upgrade, now they're throwing SIGILL the moment new PDO() runs. Basic reproduceable example:
<?php
new PDO('mysql:', null, null, [
PDO::MYSQL_ATTR_SSL_CERT => 'foo',
]);
This is happening with PHP 7.2 and 7.3.11 installed via homebrew, as well as with PHP 7.3.9 which ships with MacOS (/usr/bin/php). There's no exception to catch or anything, the process immediately throws SIGILL.
Bash shows the error as: Illegal instruction: 4
Fish shows the error as: fish: 'php test.php' terminated by signal SIGILL (Illegal instruction)
I've added Terminal/iTerm/php binaries to "Full Disk Access" in the security preference pane in case it's related to the new disk access permissions, but that didn't make a difference. Maybe the issue is too specific for help, and I don't see others reporting this, but I'm grasping here.

Related

How to solve javaBridge error php.java.fastcgi.ConnectionException?

I am using tomcat8.5, apache2, php7.25 on ubuntu 18.04
I installed php on my computer and did other configurations and installed required libraries. In the first day it worked fine and I could run a php script properly on localhost.
But next day when I tried to run the same php file I got this error.
Type Exception Report
Message Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
php.java.fastcgi.ConnectionException: Could not connect to server. Please start it with: cd /home/dr3am/Documents/phphome/WEB-INF/cgi/amd64-linux
REDIRECT_STATUS=200 X_JAVABRIDGE_OVERRIDE_HOSTS="/" PHP_FCGI_CHILDREN="5" PHP_FCGI_MAX_REQUESTS="500" php-cgi -b 127.0.0.1:9669
php.java.fastcgi.SocketFactory.test(SocketFactory.java:73)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
java.net.ConnectException: Connection refused (Connection refused)
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
java.net.Socket.connect(Socket.java:607)
java.net.Socket.connect(Socket.java:556)
java.net.Socket.<init>(Socket.java:452)
java.net.Socket.<init>(Socket.java:262)
php.java.fastcgi.SocketFactory.test(SocketFactory.java:67)
php.java.fastcgi.FCGIFactory.startFCGIServer(FCGIFactory.java:99)
php.java.fastcgi.FCGIConnectionPool.createConnectionPool(FCGIConnectionPool.java:147)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:220)
php.java.servlet.ContextLoaderListener.getConnectionPool(ContextLoaderListener.java:209)
php.java.servlet.fastcgi.FastCGIServlet.doExecute(FastCGIServlet.java:374)
php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:468)
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:479)
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
I didn't change any configuration file or removed any required library. But suddenly I got this error. I looked for solutions but I found nothing related to my problem.
What is the reason for this and how to solve it?

PHP PDO_Informix Locale Error -23101

SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101
OS: Ubuntu 16.04 64Bits
Install Informix CSDK (Version 4.10)
Compile PDO_INFORMIX (Version 1.3.3)
Enable pdo_informix.so extension in apache config
Set apache environment variables
1 - INFORMIXDIR = /opt/informix (where I installed CSDK)
2 - DB_LOCALE = en_US.819
3 - CLIENT_LOCALE = en_US.utf8
Connection String: $instance = new PDO("informix:host=$host;service=$port;database=$db;server=ol_standard;protocol=onsoctcp;client_locale=en_US.utf8;db_locale=en_US.819;EnableScrollableCursors=1;OPTIMIZEAUTOCOMMIT=1", $usr, $pwd);
The 23101 error is about DB_LOCALE and CLIENT_LOCALE, but it is all set.
Looking at the text in the error message, I think you have more than just a locale problem (23101).
If you get: "Unspecified System Error"
rather that: "Unable to load locale categories"
it means the driver was unable to find the correct text message for the -23101 error, which usually happens when INFORMIXDIR is not correctly set.
The '.iem' files (in $INFORMIXDIR/msg/en_us/0333) contains the text message for each error number. If a message can't be found you get a generic 'Unspecified System Error'.
You mentioned Apache, so I guess you are trying to run a PHP code from apache, not just the command line. Apache may not be passing the env variable to the PHP module.
If the apache env module (mod_env.so) is enabled, you may want to try putting something like this in your httpd.conf file
setenv INFORMIXDIR '/opt/informix'
so the INFORMIDIR variable will be passed to the PDO module.

ContextErrorException in DebugClassLoader.php with ParameterBag class

I'm using Symfony 2 and working with wamp server. After some time, i cannot access my pages anymore with that exception always showing, can't figuring why.
Here's the full stack trace :
in DebugClassLoader.php line 203
at DebugClassLoader->loadClass('Symfony\\Component\\HttpFoundation\\ParameterBag')
at spl_autoload_call('Symfony\\Component\\HttpFoundation\\ParameterBag') in Request.php line 240
at Request->initialize(array(), array(), array(), array(), array(), array([...]), null) in Request.php line 222
at Request->__construct(array(), array(), array(), array(), array(), array([...]), null) in Request.php line 1964
at Request::createRequestFromFactory(array(), array(), array(), array(), array(), array([...])) in Request.php line 281
at Request::createFromGlobals() in app_dev.php line 27
It seems the "DebugClassLoader" class is using reflection to analyze what's wrong and it throws an exception when getting to the ParameterBag class. A var_dump() shows that ParameterBag is implementing \IteratorAggregate and \Countable as expected but also some random class "o" which i can't figure where it comes from.
Prod environment will be an apache server running on a debian, maybe it will work on it but I'd better fix this on my current environment before going live.
All the code I have which may deal with ParameterBag is something like that :
$session = $request->getSession();
$session_id = $session->getId();
$webclient = $em->getRepository('AppBundle\Entity\WebClient')
->findOneBy(array("session_id" => $session_id));
...
Also note that clearing the cache does not fix this issue. (using php bin/console cache:clear [--env=dev])
PS: restarting apache fixes it, but it shows again later
I had that problem (not on ParameterBag but same exception in the same file), it was caused by a corrupted installation of APC. Try putting this line in your php.ini :
apc.cache_by_default = 0
In the [APC] block. If the error is gone for good, consider removing and reinstalling APC.
APC was not enabled. I tried to find if any other cache was installed to disable them but there was not. It still occurs on my dev environment.
However it does not seem to happen on my prod environment. I'll probably work with it.
If you while debugging try to clear server cache. You will face some error like:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 2444952 bytes) in C:\xampp\htdocs\project_name\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php on line 163
so to solve this issue you need to add below line in your php.ini and restart apache.
apc.cache_by_default = 0
Now see the magic. It will work fine.
thanks,
Anirudh Sood.
Update PHP version and restart the apache server.
To quote:
Currently, there are three supported versions of PHP i.e Versions 5.6, 7.0, 7.1and 7.2. As a modern-day web developer who works on different frameworks, packages need to have the multiple versions of PHP installed on your VPS.
During your development, not all your projects may support the latest version (V. 7.2) resulting you to downgrade to a much earlier version. In this tutorial, we will illustrate how to switch between the different versions of PHP from 7.2 to 7.0 to enable you to run your projects smoothly.

PHPUnit Selenium Xvfb Centos

I am trying to setup functional tests on my Centos Server using Selenium Web Server and Phpunit.
When I run the tests, I get an error in the command line :
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055 after 45000 ms.
Firefox console output: Error: no display specified
I've been doing research for more than three days and I couldn't find a solution. I read many posts, including SOverflow. As per my understanding, everything is properly set up, and yet I am experiencing the same problem as many other people, and the solutions that work for them seem to be not working for me.
This is my setup:
OS: Centos 6.5 x86 in command line (no GUI)
PHP: 5.6
Phpunit: 3.7, although I also tried with 5.3
Selenium standalone web server: 2.53, downloaded from here, although I also tried with 2.9
Xvfb system: xorg-x11-server-Xvfb
Firefox: 38.0.1, although I also tried with 38.7
I also set the DISPLAY to :99 in my bash profile:
This is what I do to set up the environment:
First, I launch the Xvfb system: /usr/bin/Xvfb :99 -ac -screen 0 1280x1024x24 &
Then I launch the Selenium server: /usr/bin/java -jar /usr/lib/selenium/selenium-server-standalone-2.53.0.jar &
I launch Firefox: firefox & (although I know this is not necessary, but just in case)
All of the three processes are running in background.
At this point, I know that Firefox is operative, as well as the X buffer. I can run the command firefox http://www.stackoverflow.com & and then take an snapshot of the buffer by executing import -window root /tmp/buffer_snapshot.png, which happens to be something like this:
I of course received a warning on the terminal: Xlib: extension "RANDR" missing on display ":99", but I read countless of times that this is not a problem.
Anyway, the problem begins just now.
I've written a rather simple functional test (please notice that other tests I've written other than functional, they work just fine, so the environment in that respect seem to be properly configured):
<?php
namespace My\APP\BUNDLE\Tests\Functional\MyTest;
use PHPUnit_Extensions_Selenium2TestCase;
class HelloWorldTest extends PHPUnit_Extensions_Selenium2TestCase {
protected function setUp() {
$this->setBrowser('firefox');
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowserUrl('http://www.stackoverflow.com');
}
public function testTitle() {
$this->url('/');
$this->assertEquals("1", "1");
}
}
And when I run the test by issuing phpunit HelloWorldTest.php, I get the following error:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055
after 45000 ms. Firefox console output:
Error: no display specified
Checking the log file generated by selenium, I found the following (interesting) lines:
21:55:46.135 INFO - Creating a new session for Capabilities [{browserName=firefox}]
[...]
java.util.concurrent.ExecutionException:
org.openqa.selenium.WebDriverException:
java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0',
revision: '35ae25b',
time: '2016-03-15 17:00:58'
System info: host: 'vmdev-pando-56',
ip: '127.0.0.1',
os.name: 'Linux',
os.arch: 'i386',
os.version: '2.6.32-431.el6.i686',
java.version: '1.7.0_99'
Driver info: driver.version: unknown
[...]
(The file contains the complete stack trace dump, and the original message of no display specified)
No errors in the Xvfb log file.
At this point I have no clue of what I am doing wrong.
Can anyone help?
Thanks a lot
A reason for the Unable to connect error is that the version of Selenium Server does not know how to work with the version of Firefox you have installed. Selenium standalone web server 2.53 is the latest and greatest. selenium-firefox-driver is also 2.53. Firefox version 38 is old. I am running firefox 45.0.1 with selenium 2.53.

Unable to run google app engine script with PHP

So, I'm trying to run the Hello World script but whenever I run dev_appserver.py I hit a wall.
Here's the error log from the script:
$ appengine/dev_appserver.py --php_executable_path=/usr/local/bin/php-cgi HelloWorld
...
ERROR 2016-03-29 12:57:30,588 php_runtime.py:348] The PHP runtime
is not available Traceback (most recent call last): File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path) File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 284, in _check_binaries
cls._check_environment(php_executable_path, env) File "/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 259, in _check_environment
raise _PHPEnvironmentError(check_process_stdout)
_PHPEnvironmentError: No input file specified.
As a background to my El Capitan setup...
I've previously updated PHP to 5.5 using:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
But I've also downloaded via HomeBrew php54 and that's what should be running the php-cgi script I've posted in the executable path above.
Any thoughts?
So turns out, the answer was pretty obvious - I'd installed the Go SDK rather than the PHP one! Google's website scrolls to the wrong place when you click PHP. Many hours wasted trying to fix this one - never mind. Hope this helps another as simple as me!
if you already installed google-cloud-sdk run this command :
gcloud components install app-engine-php-darwin
you won't need to specify that path after this

Categories