command line php,socket - php

I tried to run in my localhost (WAMP) a php code with a socket,and it work great in the browser ,but whan i tried to do the same in the command line it's throw exception "the function socket_create is not exists" .
So I tried to check if php_sockets extintion is enabled and it is,so it still doesn't work ,someone has crossed with that before ?
here is the exception :
PHP Fatal error: Call to undefined function socket_create() in
C:\wamp\www\sock et\serverc.php on line 2 PHP Stack trace: PHP 1.
{main}() C:\wamp\www\socket\serverc.php:0
Fatal error: Call to undefined function socket_create() in
C:\wamp\www\socket\se rverc.php on line 2
Call Stack:
0.0010 230696 1. {main}() C:\wamp\www\socket\serverc.php:0

PHP in CLI mode on Windows uses the php.ini file located in C:\Windows (see http://php.net/manual/en/configuration.file.php). So check here if php_socket is enabled.

Related

Fatal error: Uncaught Error: Call to undefined function get_json_data()

Here's the error upon opening php file using Docker Desktop:
0.1.2
Fatal error: Uncaught Error: Call to undefined function get_json_data() in C:\laragon\www\myproject\public\index.php:37 Stack trace: #0 C:\laragon\www\myproject\public\index.php(40): get_channels() #1 {main} thrown in C:\laragon\www\myproject\public\index.php on line 37
Local link is: localhost
I have the ff. extensions installed on VSCode:
PHP Debug
PHP Intelephense
PHP Extension Pack
PHP IntelliSense
use json_decode instead of get_json_data
It seems that the edit in settings.JSON inside VS Code had this wrong path:
"php.validate.executablePath": "C:/xampp/php/php.exe"
I had to delete the project and clone it again and now it works fine. Path shows:
"php.validate.executablePath": "C:/laragon/bin/php/php-7.4.19-Win32-vc15-x64/php.exe",
Thank you!

oci_connect() can't connect - command Line with codeigniter

Although calling the same script through browser work fine, trying to trigger the same script via CLI didn't work!
The way I have to call the script I use CodeIgniter structure :
php index.php controller/function/parameter
I have also change in config file of my project:
$config['uri_protocol'] = 'AUTO'
But the problem that oci can't work within cli although it works by calling it using the browser.
THis error appear:
Fatal error: Call to undefined function oci_connect() in C:\wamp64\www\MYPROJECT\syst
em\database\drivers\oci8\oci8_driver.php on line 238
Severity: Error Message: Call to undefined function
oci_connect() Filename:
C:\wamp64\www\MYPROJECT\system\database\drivers\oci8\oci8_driver.php
Line Number: 238
I have enabled the oci extension at php.ini
extension=php_oci8_12c.dll
which is existed in the following directory:
C:\wamp64\bin\php\php5.6.19\ext\php_oci8_12c.dll

PHP ZKLib undefined function socket_create()

I am starting doing a simple project using ZKTeco and its SDK for PHP or online SDK to connect the data from biometrics to our database. I try to use then https://github.com/dnaextrim/php_zklib because almost of the discussion from googling link to this.
Now I got an error:
> Fatal error: Uncaught Error: Call to undefined function
> socket_create() in C:\xampp\htdocs\php_zklib-master\zklib\zklib.php:16
> Stack trace: #0 C:\xampp\htdocs\php_zklib-master\zktest.php(10):
> ZKLib->__construct('192.168.5.164', 4370) #1 {main} thrown in
> C:\xampp\htdocs\php_zklib-master\zklib\zklib.php on line 16
What is the following cause of this error and what is the following solution about this?
if you are using xampp enable php_sockets.dll by removing ';' from ;extension=php_sockets.dll in php.ini file and restart the xampp.
if you are working in server contact to your server provider.

PHP Fatal error: Call to undefined function imap_rfc822_parse_adrlist()

i imported a webproject under drupal 7 cms and i'm facing this error on sending email using drush in terminal typing this command (drush queue-mail-send-all) :
$ drush queue-mail-send-all
PHP Fatal error: Call to undefined function imap_rfc822_parse_adrlist() in C:\wamp\www\example.com\sites\all\modules\
custom\example\example.module on line 96
PHP Stack trace:
PHP 1. {main}() C:\ProgramData\Drush\drush.php:0
PHP 2. drush_main() C:\ProgramData\Drush\drush.php:16
PHP 3. _drush_bootstrap_and_dispatch() C:\ProgramData\Drush\drush.php:61
PHP 4. drush_dispatch() C:\ProgramData\Drush\drush.php:92
PHP 5. call_user_func_array() C:\ProgramData\Drush\includes\command.inc:182
PHP 6. drush_command() C:\ProgramData\Drush\includes\command.inc:182
PHP 7. _drush_invoke_hooks() C:\ProgramData\Drush\includes\command.inc:214
PHP 8. call_user_func_array() C:\ProgramData\Drush\includes\command.inc:362
PHP 9. drush_queue_mail_send_all() C:\ProgramData\Drush\includes\command.inc:362
PHP 10. queue_mail_send() C:\wamp\www\example.com\sites\all\modules\contrib\queue_mail\queue_mail.drush.inc:58
PHP 11. HTMLMailSystem__SmtpMailSystem->format() C:\wamp\www\example.com\sites\all\modules\contrib\queue_mail\queue_mail.module:102
PHP 12. HTMLMailSystem->format() C:\wamp\www\example.com\sites\default\files\mailsystem\HTMLMailSystem__SmtpMailSystem.mail.inc:20
PHP 13. theme() C:\wamp\www\example.com\sites\all\modules\contrib\htmlmail\htmlmail.mail.inc:51
PHP 14. example_preprocess_htmlmail() C:\wamp\www\example.com\includes\theme.inc:1122
Fatal error: Call to undefined function imap_rfc822_parse_adrlist() in C:\wamp\www\example.com\sites\all\modules\custom\example\example.module on line 96
Call Stack:
0.0010 152632 1. {main}() C:\ProgramData\Drush\drush.php:0
0.1120 1764552 2. drush_main() C:\ProgramData\Drush\drush.php:16
1.7801 4843496 3. _drush_bootstrap_and_dispatch() C:\ProgramData\Drush\drush.php:61
58.5523 40781840 4. drush_dispatch() C:\ProgramData\Drush\drush.php:92
61.0695 40787544 5. call_user_func_array() C:\ProgramData\Drush\includes\command.inc:182
61.0695 40787640 6. drush_command() C:\ProgramData\Drush\includes\command.inc:182
61.0705 40787800 7. _drush_invoke_hooks() C:\ProgramData\Drush\includes\command.inc:214
61.0895 40819048 8. call_user_func_array() C:\ProgramData\Drush\includes\command.inc:362
61.0895 40819144 9. drush_queue_mail_send_all() C:\ProgramData\Drush\includes\command.inc:362
61.2285 40873112 10. queue_mail_send() C:\wamp\www\example.com\sites\all\modules\contrib\queue_mail\queue_mail.drush.inc:58
61.2315 40874976 11. HTMLMailSystem__SmtpMailSystem->format() C:\wamp\www\example.com\sites\all\modules\contrib\queue_mail\queue_mail.module:102
61.2315 40875000 12. HTMLMailSystem->format() C:\wamp\www\example.com\sites\default\files\mailsystem\HTMLMailSystem__SmtpMailSystem.mail.inc:20
61.2315 40876840 13. theme() C:\wamp\www\example.com\sites\all\modules\contrib\htmlmail\htmlmail.mail.inc:51
90.3282 58206648 14. example_preprocess_htmlmail() C:\wamp\www\trustedco
Drush command terminated abnormally due to an unrecoverable error.
m[error]?[0m
Error: Call to undefined function imap_rfc822_parse_adrlist() in
C:\wamp\www\example.com\sites\all\modules\custom\example\example.module
-i can send emails with normal php function.
-i enabled imap in php.ini.
-i eneabled impap in wamp setting as php extention.
-my php version is : 5.4.16
-my apache version is : 2.4.4
- I'm using wamp server 64 X
- my OS windows 7 : 64 bit
i was trying to google this error for 3 days but i didnt find something helpfull
I got the solution:
I am running Windows 7 64bit environment with WAMP server, it has two php.ini files:
C:\wamp\bin\apache\apache2.4.4\bin
Enable php_imap.dll extension by removing ; at beginning of string
C:\wamp\bin\php\php5.4.16
Enable php_imap.dll extension by removing ; at beginning of string

ApiGen on windows.Can't able to run apigen command

Can anybody tell how to get working APIGen on windows. I have installed ApiGen using PEAR and the file of ApiGen resides in
C:\wamp\bin\php\php5.3.13
there are two types of file here one with batch extension and other with file extension both having name apigen.
I am getting below error while using apigen command.
Warning: require(Texy.php): failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.13\apigen on line 48
Call Stack:
0.0015 792712 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
0.0141 1646736 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
0.0142 1647048 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
Fatal error: require(): Failed opening required 'Texy.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\bin\php\php5.3.13\apigen on line 48
Call Stack:
0.0015 792712 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
0.0141 1646736 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
0.0142 1647048 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP Warning: require(Texy.php): failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.13\apigen on line 48
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
PHP 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP Fatal error: require(): Failed opening required 'Texy.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\bin\php\php5.3.13\apigen on line 48
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
PHP 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
Please follow these step (refer from this page https://github.com/ApiGen/ApiGen/wiki/installation-on-windows)
Install apigen.phar in directory you want. For example: C:\PHPCLI
Add C:\PHPCLI to Windows Path
In case that you or anyone don't know how to add Path in Windows. Right click on My Computer icon on desktop or start menu and click on Properties.
On left side of Windows properties page, click on Advanced system settings.
Click Environment Variables...
You can add C:\PHPCLI to Path in user variables or system variables. Choose one.
Click OK to all.
Open command line and enter cd C:\PHPCLI
Enter in command line again: echo #php "%~dp0apigen.phar" %*>apigen.bat
Close command line and open new command line. Test by enter this command apigen --help
It should display ApiGen help message.

Categories