update CURL in PHP WAMP windows - php

i encountered an issue and can't seem to be able to solve it.
i downloaded the cURL from http://winampplugins.co.uk/curl/
and mapped my sys path to it which runs at 7.49.1 but my PHP is still running 7.42.1
How can i map or point the latest CURL to my php?
any pointer are greatly appreciated.
Cheers

As far as I know there is no such thing as downloading vanilla cURL and binding it with PHP. You need PHP version of cURL.
Step by Step
Step 1
Download for 32-bit:
http://windows.php.net/downloads/releases/php-5.6.7-Win32-VC11-x86.zip
Download for 64-bit:
http://windows.php.net/downloads/releases/php-5.6.7-Win32-VC11-x64.zip
Step 2
Extract File (Overwrite file - It is a good idea to keep a backup of
the file in case something fails): /etx/php_curl.dll into
C:\wamp\bin\php\php5.5.12\ext\
NOTE: your phpx.x.x folder might be different (depends on your php version)
Step 3
Restart Apache from WAMP Control Panel
Source

Related

Nothing has worked to code PHP in Visual Studio Code via Windows 10

I am taking a Udemy class for WordPress. I can create a function just fine. However, when I started using the variables and array it will not work. I get a message saying there is no "php.validate.executablePath" and "php.executablePath" via settings.json.
So I downloaded the zip file of PHP 7.3 (7.3.17) VC15 x64 Non Thread Safe and extracted it to C:\php7.3. I then added the path to the settings.json: "php.validate.executablePath": "C:\php7.3\php.exe", "php.executablePath": "C:\php7.3\php.exe"
I then restarted my VSC and nothing happened. I even restarted my computer. The notification never popped up again but I still cannot run PHP. In replace of the \, I used one \, then one /, then two / but it did not change anything. I looked this issue up - found others who had the same issue - and have not found anything that has worked for me so far.
I also tried downloading the xampp but there was an issue at port 443. That's when I downloaded the PHP file directly and uninstalled xampp.
EDIT: Do I have to have something like xampp or wamp to execute the PHP? If so, I would just need to figure out how to fix that error.
Here is a screenshot of the code I used: http://prntscr.com/sahb1f
Here is a screenshot of the settings.json: http://prntscr.com/sahbk0
I am on Windows 10 x64. A tool extension for VSC costs money, which I do not want to spend.
Any help?
Thanks!
You are missing the echo in front of the $names[0] array element access.
change your line to this <p>Hi, my name is <?php echo $names[0]; ?></p> and it should work however your error to do with executablePath might be because of something else.

EasyPHP Devserver 16.1 Curl Win 10

EasyPHP don't start.
When clicking on start server or start DB nothing happens.
No error logs whatsoever....
I had a lot of trouble to make this all work.
First I had to get rid of all old Easyphp versions!
Make sure you have the right runtimes installed, both x86 & x64 if you have a 64bit system!
I had to shutdown Malwarebytes Anti-Malware, EasyPHP wont start if this is running, you even can get a Riskware message from it!
After all this I could get EasyPHP 16.1 to start, now I needed to activate Curl.
Follow all instructions I could find here.
Copied libeay32.dll, libsasl.dll, ssleay32.dll from php dir to c:\windows\system, c:\windows\system32 and even to c:\windows\sysWOW64.
removed the ';' from the 'extension=php_curl.dll' line in all three ini files in both php dirs.
But the trick that finally make Curl worked for me was to add the path to each php directory to the global 'Path' variable via (rightclick startmenu)System->advancedsettings->globalvars, dubbelclick on 'Path' and add the complete path to your php dir, one line for each php dir!
Maybe not every step is needed for you but for me this finally worked. If you still have trouble then maybe there is some antimalware or antivirus program running what for some reason stops EasyPHP from running!.
There are so many questions about this so I decided to put this in here as it is.

Using Cassandra PDO Driver on Windows

Is there any way to have Cassandra PDO at Windows with Wamp?
This is for development purposes I don't want to install Linux and change all the environment.
https://code.google.com/a/apache-extras.org/p/cassandra-pdo/
I'm using Windows 7 (64 Bit), Wamp 2.5, PHP 5.5.
OK, here's what I found out:
1) It's totally possible
2) The docs that appear in the first google search results are a bit obsolete
Start by downloading the latest Datastax Community Cassandra here:
http://planetcassandra.org/cassandra/
Install & setup properly. In fact, most of the configuration is done by the installer, you just have to edit the apache-cassandra/conf/cassandra.yaml file to find all paths to /var/lib... and change those into something like d:/cassandra/... That includes "commitlog", "data", "saved_caches". Restart the Cassandra service, examine the logs. Mine shown no problem. The OpsCenter at ...:8888/opscenter/index.html was working fine, showing one node online.
Now, the PHP part.
There's a sneaky thing called Thrift. From what I've learned today (I first heard about Cassandra and Thrift yesterday), it's a way describe a binary protocol of connecting to some online service, in this case, to Cassandra. It will basically generate PHP files that will provide all the connectivity you need from PHP itself (no extensions needed).
You will need:
1) The Thrift PHP libs
2) The .exe Thrift compiler
Both can be downloaded here:
https://thrift.apache.org/download
Then use the following command to compile PHP files that will act as a "driver" to connect your PHP applications to Cassandra:
thrift --gen php D:\DataStaxCommunity\apache-cassandra\interface\cassandra.thrift
Put the result in some PHP include_path folder.
Also, find the PHP Thrift libs (in the libs archive from the same download page) and put those in a folder accessible to your script (e.g. include_path or the project folder).
Refer this page:
thrift.apache.org/lib/php
I guess that should help!
I have same problem as you, but when i tried this method, it works correctly for me.
Reference link
Here is a code example, very easy to understand :
<?php
require_once 'Cassandra/Cassandra.php';
$o_cassandra = new Cassandra();
$s_server_host = '127.0.0.1'; // Localhost
$i_server_port = 9042;
$s_server_username = ''; // We don't use username
$s_server_password = ''; // We don't use password
$s_server_keyspace = 'cassandra_tests';
$o_cassandra->connect($s_server_host, $s_server_username, $s_server_password, $s_server_keyspace, $i_server_port);
$s_cql = "CREATE TABLE carles_test_table (s_thekey text, s_column1 text, s_column2 text,PRIMARY KEY (s_thekey));";
$st_results = $o_cassandra->query($s_cql);

How to get pthreads working in PHP?

I am using wampserver to test & run wordpress code in my local computer. In order to run pthread, I have followed the following steps:
1) I got the pthread zip file from http://windows.php.net/downloads/pecl/releases/pthreads/0.44/
(My machine has php 5.3.13 and downloaded the php_pthreads-0.44-5.3-ts-vc9-x86.zip file from the above link).
2) Extracted the zip file. Moved the php_pthreads.dll to the C:\wamp\bin\php\php5.3.13\ext directory.
3) Moved pthreadVC2.dll to the C:\wamp\bin\php\php5.3.13 directory.
4) Then Opened C:\wamp\bin\php\php5.3.13\php.ini and added the code extension=php_pthreads.dll at the begining of the file.
But when I try to run the following code:
<?php
class My extends Thread {
public function run() {
printf("%s is Thread #%lu\n", __CLASS__, $this->getThreadId());
}
}
$my = new My();
$my->start();
?>
It gives me the following error:
Fatal error: Class 'Thread' not found in C:\wamp\www\wp-admin\includes\post.php on line 2
Can you please tell me how to install pthreads in my computer to use with php? and do I have to install any other software?
I've noticed that wampserver has php.ini in two separate places. One place is in the /wamp/bin/php/php5... directory, and the other place is in the /wamp/bin/apache/apache.../bin directory (where "..." represents version numbers). The two files need to be identical, because apparently both are loaded at different times by the overall wampserver boot-up procedure.
(Note I only discovered this recently, and may be well "behind the curve" of doing fancy things with wampserver --maybe everyone else has been dealing with both files for a long time. So I don't know if this simple thing will fix your problem; I came here looking for info, myself, regarding doing some multi-threading stuff. :)
One other thing. According to this page: www.php.net/manual/en/pthreads.requirements.php
PHP has to be compiled with "--enable-zts" in order for pthreads stuff to work. I have not been able to find any evidence that the PHP part of wampserver was compiled that way.
(months later)
Having decided I didn't really immediately need to do any threading stuff, I went on to do other things, until the need actually arose. I now can say that the version of PHP compiled into WampServer does support the "pthread" extension, although some set-up work is needed, first. The instructions I saw mentioned putting a couple of .dll files (after a download and unZip) into certain places, but that didn't work for me. Copying them to the \Windows\System32 directory did work. (Putting them into the \apache...\bin directory also works; there are some other php .dll files in there.)
After that, much like what you did, it is necessary to define a "class" that extends the "Thread" class, in order to actually do something in another thread. The "run()" function in the Thread class is "abstract", and needs to be "realized" as an actual function in the extended class. Then the "new" operator can create an "instance", an object of that specified class, for actual use. Here's the class that I needed:
//Purpose: Use another thread to run the code in another php file, after a delay
class xT extends Thread
{ var $fil, $tim;
function savWhatWhen($f="", $t=0)
{ $this->fil = $f; //save What, file to process
$this->tim = $t; //save When, delay before processing file
return;
}
function run()
{ ini_set('max_execution_time', 600); //600 seconds = 10 minutes
sleep($this->tim); //do a delay; beware of max-exec-time!
include($this->fil); //load file-to-process, and process it
return;
} }
That "savWhatWhen()" function was created specifically for this extension of the basic Thread class. Here's some code for using that class:
$TH = new xT(); //prepare a separate Thread
$TH->savWhatWhen("d:/wamp/myscripts/test.php", 45);//file-name and delay time
$TH->start(); //after delay, process file
//the code that does this can terminate, while OTHER thread is doing a delay
Note for anyone copying this code, you might need to make sure your "open_basedir" setting in the php.ini allows access to the specified file.
More months later: With lots of things being worked on, I haven't put a lot of time into using my pthread object. I did encounter a peculiarity that makes me wonder about whether or not I can actually use pthreads the way I had hoped. Here is what I have observed:
1. An initial php file is called by AJAX, to do something.
2. The PHP processor on the Web Server does that thing.
3. Various data is supposed to be echoed to the browser.
4. The initial php file calls for the creation of another thread, and terminates.
5. The browser does not yet receive the echoed data!
6. The PHP processor on the Web Server does the work delegated to the second thread.
7. When the second thread terminates, NOW the browser receives the echoed data!
At this writing I'm thinking I missed something. Perhaps I need to do some forceful "flush" stuff when the first thread ends, so that the browser can receive the echoed data and the user can do things while the PHP processor on the server is also doing things.
Check for extension_dir = "ext" in you php.ini file. Make sure it points to the folder where your extensions reside and make sure it's not commented (it has a semicolon ; in front of it)
You have to add a require_once() with the path of the Thread class before extending it (if your framework don't use an autoload class system)
I've encountered the same problem, in my case placing the pthreadVC2.dll in
..wamp\bin\apache\Apache2.4.4\bin
(instead of ..\wamp\bin\php\php5.4.16 as the guide in php.net instructs) solved the problem
Wamp server has a separate php.ini config file for the browser and for the cli.
To use the pthreads module in the browser with WAMP Server you need to copy the "pthreadVC2.dll" into the apache "bin" directory also.
You should now have he "pthreadVC2.dll" in both of these folders (if installed in default location):
C:\wamp\bin\php\php[x.x.xx]\bin
C:\wamp\bin\apache\apache[x.x.x]\bin
You will also need to update the php.ini file within the php bin directory AND the apache bin directory to include:
extension=php_pthreads.dll
This now means you can use pthreads in the browser and in the cli with wamp server
After encountering the same problem, I noticed that I have installed the wrong Pthread version (3.1.6 : requires PHP7+) which wasn't compatible with my PHP version (5.5.12). Solved the problem with Pthread version 0.0.44. An earlier version should probably work well.
Here is the download page for Pthread and the installation page. Be careful about the both php.ini location as mentioned above (Apache folder=for Browser, PHP folder=CLI).

problem in Encrypt php code for intellectual property

I have downloaded phpshadow which is a php encoder
I followed whole of explanation of installing it in the tutorial such as adding php extension which was phpshadow.so
I copied this file in /usr/lib/php5/extensions
and in php.ini
I wrote this line
extension=phpshadow.so
it is the site:
http://www.phpshadow.com/index.php
I can encrypt my projects successfully
I went to my php pages all of them were encrypted
when I encrypt it it will make a backup from it too
I can't again go to browser and again see my project when I've encrypted it.
How can I encrypt my pages while I can access them too?
I don't know what's wrong with it
I have downloaded a free trial
also I've downloaded phpshadow.licence too
it is the command that I try and then my project will be encrypted:
./phpshadow-encoder -l /etc/phpshadow/phpshadow.licence /srv/www/htdocs/didebansnort/
If you have any other suggestion about encoding files I would be happy to know.
Thanks.
After spending 45' I made it work!
I tested both standard software version and online version.
Standard Software Version
Download the appropriate extension and encoder tool.
Warning! I am working in x64 Linux but I am using a 32bit version of lampp(xampp) and I needed to download the Linux 32bit version to make it work. Otherwise I was getting an "ELFCLASS64 in Unknown on line 0" in php error log.
Place the extension in your extension directory and edit your php.ini to include the file like
extension=phpshadow.so or extension="/full/path/phpshadow.so"
Then download the license and place it in /etc/phpshadow.
Use the encoder to encode your php files.
Then test it!
Problems
The free license has expired since 01/08/2011. You can set your computer clock back to 30/07/2011 and it will work.
Also, let me remind you:
Note: The free trial licence introduces a 10-second delay on each HTTP request. It is otherwise fully functional
Finally, if you don't place the license file in /etc/phpshadow it won't work.
Online Version
Encrypt a single .php file under 200 bytes for FREE
Everything except the encryption process works as the Standard Software Version.
Warning! You have to download the license for this from here.
That license hasn't expire yet. Also the online version doesn't introduces the 10-second delay.
Finally, again if you don't place the license file in /etc/phpshadow it won't work.
TIPS
Check your php and webserver error log if something goes wrong
To change date in linux see here
You can find your php extension directory in php.ini or use the phpinfo(); function
and look for *extension_dir*
If your php.ini changes doesn't take place make sure that you are modifying the correct file (in phpinfo(); look for Loaded Configuration File)
When the phpshadow.so is loaded check it with phpinfo(); or print_r(get_loaded_extensions());

Categories