Php to ssl proxy - php

Is it possible to find a php module that can connect with ssl proxy, without need for install php or a apache mods?

I'm not quite sure what you're trying to achieve, but either PHP's cURL library or fopen() function should do what I think you're looking to do.
cURL does need to be installed (but is often present by default). However, I believe the slower fopen() function should be available in most shared hosting environments (which is what I assume you're using).

Related

Is cURL in PHP tied to the local install of cURL?

IE, does PHP use its own, internal version of cURL or does it use whatever it finds in the local OS (Windows 10)? I'm in the unfortunate position of trying to make scripts written in 7.4 work on a permanent home that's saddled with 7.1. Before I force an update of PHP, I want to make sure chasing the right problem. I've searched php.ini and don't see a path to the local file system.
Thanks!
The curl functions in PHP do not call out to a command-line version of curl, but rather to a library which can be integrated into a C program.
This version may be included "statically" when PHP is compiled, be a separate file installed alongside PHP, or use a shared file installed centrally on the server and used by multiple programs. This will be determined by the distribution package of PHP.
To determine the library version used, use the phpinfo() function, or run php -i on the command line (which just runs that function for you) and search for "curl", which will show the version.
I'm not sure what your question is.
IE is not an issue here.
I always keep a script that gives me the current state of PHP.
PHP Manual, phpinfo()
<?php
phpinfo();
?>
phpinfo will return something like this if curl is (likely) installed.
I learned through the process of installing PHP 8.1 in my dev env and configuring it to use curl (and a comment), that PHP does call it's own curl executable, in the case of windows 10: php_curl.dll, and does not make an external call to curl in the operating system.
My fear was I'd go through the process of getting someone to upgrade PHP then have to have ask, again, to have curl upgraded.
Thanks to all who offered input!
yes, but curl is an extension, you need to enable it in php.ini file

PHP postgres enable ssl support

Sorry to get back to you for a question that has been asked many years ago. But I am really stuck with this.
I have a legacy application which is very old, running PHP 5.2.17.
I followed this guide to setup my docker container
https://andrewscaya.net/blog/bringing-php-52-back-life
I have everything setup correctly. I made a downloaded and compiled a PHP installation and configured this with Apache. And its working fine with php.
However, it is essential that I have SSL support (in PHP) for the POSTGRES connection.
Which is now default not enabled according to PHPINFO
I have basically the very same problem somebody else had many years ago. SSL support of Pgsql
See:
Enable SSL support for pgsql
So from what I am understanding is that I need to recompile PHP again, but with a package called libpg ?
Where do I get this package and how can I compile this with the PHP source code?
After 2 days of searching I finally found LAPP stack which has some older versions available with pgsql ssl support
https://community.bitnami.com/t/can-i-get-the-installers-for-wapp-and-lapp-stacks-for-5-4-45/38548
In the long-run I would recommend upgrading PHP versions, but I understand that this can be a lot of work. There are many good guides on upgrading versions. I recommend going through the version upgrades one-by-one, dealing with deprecated features and other potential problems one-at-a-time and testing each script.
In the short-term, I'm not sure if this would work, but PDO is supported in 5.2 (actually in 5.1 even) and as it simply passes info to the PostgreSQL library, I would expect SSL support to work. I have used it in 5.4, and I am not aware of any changes made between those two versions.
There is a solution here, by IMSoP, that explains how to get this working and points you to more official documentation if you need more info: Connecting to PGSQL over SSL via PHP PDO
If this fails, a second approach that I would try would be to create an SSH tunnel to connect to a local port. An example would be:
ssh -L 127.0.0.1:5443:127.0.0.1:5432 username#remoteboxaddress
Then you can initiate what looks to PHP like a local connection on port 5433, but it will actually be a (secure) SSH tunnel to the remote box. This will also require that the remote box is configured to accept (non-encrypted) local connections, and that you have SSH access to it. Then, if you test it out and it works, you can make a script to start the tunnel on boot, or better yet, when the webserver is started; this necessitates using an authentication method like keys stored in a file, that doesn't require the entering of a password. So...there are a lot of "if's" here, in terms of whether or not you will be able to get this solution to work, but it can be done if you have root access on both servers, and occasionally if you do not, depending on how they are configured.
Hopefully, one of these two solutions will work for you.

Pure PHP implementation of SQLite?

Is there a pure PHP implementation of SQLite that will run on PHP 5.1.6? I am working on an application that would benefit from being able to store data in a relational database, but the server that it has to run on is stuck with PHP 5.1.6 and has been configured "'--without-sqlite"
I have no control over this server; cannot recompile, upgrade or otherwise modify PHP aside from using .htaccess files. Hosting externally is also not an option, unfortunately. MySQL may be possible but would be a nightmare trying to get their IT to create a database for me. (It took them 6 weeks to get .htaccess files enabled because of red tape and other things)
Am I out of luck? My fall back is to write everything to flat files but I really would rather not do that.
EDIT: Fixed typo. PHP does not have the SQLite extension and was configured "'--without-sqlite" according to the output of phpinfo()
Actually, you could easily download and install sqlite in your userspace, whether on windows or on a linux remote shell doesn t usually matter unless your host is unusually restrictive, if that is the case you should change service provider.
Once sqlite is installed, you can one of the available pear extensions or pecl extension to allow easy access through php.
Tutorial and code examples for the pear solution here.

Best single server solution for GWT, PHP, and SSL

So right now I'm rocking Apache 2.2, which I've had running for a couple years (only for local purposes). With Apache, I have PHP 5 installed. Recently I installed Tomcat 7 for Java Servlet support (GWT specifically). I also have Tomcat supports SSL (on a separate port which is annoying but manageable for now).
Here's my problem. GWT cannot use PHP pages and PHP cannot use SSL (unless I install that on Apache). What would be the best solution to get GWT, PHP, and SSL on single server or at least able to interact.
I was thinking maybe install PHP on Tomcat because it already has GWT and SSL ready but a quick Google search didn't show promise on this. Another option I've heard is that Apache can forward certain requests (such as Java Servlets) to Tomcat. I'm hoping someone has a quick answer to save me the headache of Googling.
Also, Apache is running on port XXX1, Tomcat XXX2, and Tomcat SSL XXX3. Is there a way to get these all on a single port? I'm guessing it'd have to be configured at the router/gateway and forwarded to each correct port?
Use Apache as a proxy for Tomcat, and have the SSL configured on Apache. You'll need to use mod_proxy for this. A sample configuration would look like this:
ProxyPass /tomcat/ http://127.0.0.1:XXX2/
You'd then access the Tomcat resources by prefixing a /tomcat/ to the URL path.
Resin is a Java application server with a full PHP5 implementation.
http://quercus.caucho.com/
Just completing the answer given by Jon, take a look to this configuration to serve the Tomcat applications from Apache.
Tomcat, it seems, can run PHP. Found that answer on another Thread which points to this handy tutorial. I'd still like to know if anyone has another solution?

XML-RPC with PHP and GoDaddy? Confusion sets in

I am attempting to work with XML-RPC via PHP on a GoDaddy server.
This same server is hosting a Wordpress Blog that makes use of XML-RPC and is functioning, though that may be unrelated...
Whenever I attempt to use any functions that are integrated into PHP for use with XML-RPC, I get an error (function list here: http://us3.php.net/manual/en/ref.xmlrpc.php) e.g.:
Fatal error: Class 'xmlrpc_client' not found
Is this because XML-RPC's PHP functions are not enabled on my server? If so, how do I go about enabling those - it would seem I would have to install the XML-RPC library to do so and of course I cannot do that on a shared server. Doesn't Wordpress use the same batch of XML-RPC functions though (it works fine)?
I think I have managed to thoroughly confuse myself. I have zero experience with XML-RPC.
The first point you made regarding the same server hosting a site supporting XML-RPC, is quite odd, as XML-RPC is enabled at compile time. There are no directives to be used in the php.ini file, and you therefore couldn't enable XML-RPC at run time using ini_set(). This would point to either a different server or several PHP instances running on the same server.
Either way you need to have this extension enabled at compile time, which is out of your hands. So you would have to contact somebody at GoDaddy to get this working.
An alternative to that, would be to look at something like Zend_XmlRpc which is well supported and doesn't require the PHP XML-RPC extension to work.
Good luck.

Categories