I was wondering if it is possible to install Suhosin for php without completely recompiling the php library. I've looked around a lot an all I was able to find are resources for Linux and other windows alternatives. I did stumble upon one resource for windows, but it requires re-compiling php with Suhosin enabled, is there a way to do this on an existing, compiled php library?
I tried php -f suhosin-patch-5.3.9-0.9.10.patch in the cmd which gives a console output but no actual file is compiled, so installing the extension is not possible at this point.
here is the windows resouce:
http://board.deioncube.in/showthread.php?tid=96
Thanks.
-f is a flag for the compiled interpreter that makes the interpreter execute the specified php source code. suhosin is a patch to the php interpreter, which is written in C.
Therefore, you must download the source code of the php interpreter, apply suhosin, and then recompile php.
Related
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
I have a PHP shell on a Linux red-hat server with user privileges. I'm trying to symlink the root directory and still its impossible using ln -s or even symlink() in PHP.
I have seen that PHP DL function is disabled like this picture:
I used a php.ini in my current directory witch contain this string:
safe_mode=OFF
disable_functions=NONE
and it didn't disabled, so what to do?
The dl function, and the ability to dynamically load PHP extensions, has been removed from all PHP SAPIs, with exception of CLI SAPI, since PHP 5.3 (and 7.0 in php-fpm).
Warning This function was removed from most SAPIs in PHP 5.3.0, and was removed from PHP-FPM in PHP 7.0.0.
Source php.net/dl
So unless you're running PHP 5.2, there is no use for that function in a Web SAPI. You shouldn't be trying to dynamically load your extensions at runtime in a web environment anyway. It usually doesn't make any sense and can result in a lot of edge cases. Most of these edge cases are moot in a CLI environment, but matter to a web environment.
As for overriding disable_functions you want to make sure you're editing the correct php.ini file and checking phpinfo() from the correct SAPI. Remember that the PHP running from CLI and your Apache/web are two different binaries, that can load different configuration files. So you should have a look at phpinfo() from the correct one to find the "Loaded configuration" file to edit. You always need to restart PHP for these loaded configurations to take effect. Just keep in mind that dl() likely is removed from any current supported version of PHP.
I downloaded WINCACHE-1.3.7.4.tgz from the PECL download page. Unpacking it i find many a C orientated source file. Compiling from source in Linux i have some experience in BUT none at all in Windows (i am running Windows 7).
The instructions on PHP.net's WinCache pages does not seem to match the files extracted from the `.tgz'
I have looked at suggested questions
Creating Windows DLL from C++ source files
Creating php DLL from pecl source files
but i have NO idea where to actually start off.
And thus, does anyone know how i would build WinCache .DLL from the provided source? (if at all easily possible)
Do you really need to build this extension from source? If not, you can download precompiled DLLs here. If yes, you have to follow this tutorial for compiling PHP extension on Windows. Basically, you have to build PHP and it will also compile extension that you will enable. After successful compilation you should be able to find required dll and use it with your running PHP.
But another question is for what do you need it? What version of PHP do you use? If 5.5+ you should consider OPCache instead WinCache.
Since the Zend Opcache extension is now in the core PHP product, the WinCache opcode cache is disabled by default. As of PHP 5.5, the opcode cache portion of WinCache is deprecated, and will be removed in a future release of the WinCache extension.
I am using php version 5.3 on media temple's grid server, however when I call a file using exec() the page is executing in PHP version: 4.4.9
The reason I am using exec() is to process the file in the background.
This is probably a simple question, but how do I manually set the PHP version to 5.3 for this file without using .htaccess?
Thanks.
The PHP interpreter you invoke via exec() is often a CGI version installed on the server as /usr/bin/php. You need to find out if a more contemporary version is available and then call the interpreter explicitly:
exec("/usr/bin/php-5.3 your-script.php &");
# or just adapt your scripts shebang #!/usr/bin/php5
(Just an example, the filename will be different. Also you can usually leave out the path. It's mostly just security relevant for setuid binaries.)
You might find out about other versions via print_r(glob("/usr/bin/php*")). But asking your hoster might be a better idea.
I don't do a huge amount of php work and I've never used bcompiler before but I'm migrating a php site to a new server and I can't get this working.
There seems to be a class compiled with bcompiler 'class.viewimage.php' - it contains bz compressed code 'BZh91AY&SY;iu...'
There is then a regular php file that is calling this class:
require('class.viewimage.php');
$my_image = NEW ViewImage ($MEDIALIB->Filestore);
When this code is run it just spits the text contents of the compiled class into the browser ('BZh91AY&SY;iu...'). It's the require line which is causing this. Seems to me like php doesn't magically know that this is compiled code.
To the best of my knowledge I've installed Bcompiler on the system as this code is no longer crashing (and it was crashing when I first did the migration):
if (!extension_loaded('bcompiler')) {
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
dl($prefix . 'bcompiler.' . PHP_SHLIB_SUFFIX);
}
Any help appreciated.
While I've had my own troubles with PHP bcompiler, using include() or require() to access compiled code (compiled using bcompiler_write_file()) on a machine with the bcompiler module installed and enabled should work.
http://us2.php.net/manual/en/function.bcompiler-read.php:
Note:
Please use include or require
statements to parse bytecodes, it's
more portable and convenient way than
using this function.
Not only are there a multitude of bugs, but versions are incompatible with one another, which is what I'm guessing is your problem.
For example, my two (incompatible) machines:
CentOS 5.5, PHP 5.2.10, Apache 2.2.3, x86_64
----
bcompiler version 0.9.3-devs
current bytecode version 0.21
can parse bytecode version 0.7, 0.9, 0.11, 0.12, 0.14,
0.18, 0.21
Mac OS X 10.6, PHP 5.3.3, Apache 2.2.15, i386
----
bcompiler version 0.9.3-devs
current bytecode version 0.22
can parse bytecode version 0.20, 0.22
I submitted it as a bug to the PECL package.
PHP considers all require/include files to be plain text, and will treat them as such until it spots either the <? (shorttag), <?php (regular tag), or <% (ASP tag) character sequences in the stream, after which it switches into PHP mode, until it hits the end of the script or the corresponding closing tag (?>, %>). As such, there's no way to have PHP treat a compiled input as program code. Even an EVAL won't help, since that just invokes the same parser that didn't trigger off the binary input in the first place.
BZipped code itself isn't executable either, unless it's been wrapped by an auto-extractor stub.
Since it would appear to be BZipped, why not try un-bzipping the file and see what you get? Maybe the class file was downloaded as a .bz2 distribution and simply got renamed. The uncompressed copy may contain the appropriate wrappers to allow execution.
I have been struggling since a long time to work with bcompiler but surprisingly i found a very easy solution where you can compile you whole website with one click. you can follow the bellow steps:-
Download and install Wampserver (any edition).
Download and install Wampserver PHP Addons Version php 5.2.5
click on Wampserver -> PHP -> Version -> 5.2.5 from Task bar (it will change your current version of php to 5.2.5).
Select Wampserver -> PHP -> extension -> php_bcompiler (it will enable bcompiler on your computer).
Above steps are enough if you can compiler the script your own but to make it easy you can continue with next steps.
Download bcompiler GUI.
Select the Folder on the Bcompiler GUI and this will compiler your whole website with one click.
enjoy PHP | Enjoy Open Source