英文:
PHP extensions are showing not enabled through web browser but working through command line
问题
I have a problem with my XAMPP installation, basically i have installed XAMPP with php7 and later added php8 to it. both are running perfectly on different ports. now i am trying to open socket extension but it gives error
> Call to undefined function socket_create()
but on command line(through php7 and php8) it is executing without any error and when i try to execute same script from web browser it gives me error that
> "Call to undefined function socket_create()"
i checked the available extension with the "get_loaded_extensions" function and on php7 it gives the following list (through command line)
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => bz2
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => openssl
[28] => curl
[29] => fileinfo
[30] => gd
[31] => gettext
[32] => mbstring
[33] => exif
[34] => mysqli
[35] => pdo_mysql
[36] => pdo_sqlite
[37] => sockets
[38] => Phar
[39] => ftp
and following extensions through php8 (command line)
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => bz2
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => openssl
[28] => curl
[29] => fileinfo
[30] => gd
[31] => gettext
[32] => mbstring
[33] => exif
[34] => mysqli
[35] => odbc
[36] => Phar
[37] => pdo_mysql
[38] => pdo_sqlite
[39] => soap
[40] => sockets
[41] => xsl
[42] => ftp
but when i ran same script through web browser it gives my following extensions
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => Phar
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => apache2handle
which are less than both versions.
I have already enabled the socket extensions in both PHP.ini files
extension=sockets
Here is the error data from error.log file and php_error.log file is empty
> [Sat May 13 12:02:41.037386 2023] [ssl:warn] [pid 4192:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.095157 2023] [core:warn] [pid 4192:tid 592] AH00098: pid file D:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat May 13 12:02:41.102153 2023] [ssl:warn] [pid 4192:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.145647 2023] [mpm_winnt:notice] [pid 4192:tid 592] AH00455: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.6 configured -- resuming normal operations
[Sat May 13 12:02:41.145647 2023] [mpm_winnt:notice] [pid 4192:tid 592] AH00456: Apache Lounge VC15 Server built: Dec 23 2021 11:00:40
[Sat May 13 12:02:41.145647 2023] [core:notice] [pid 4192:tid 592] AH00094: Command line: 'd:\xampp\apache\bin\httpd.exe -d D:/xampp/apache'
[Sat May 13 12:02:41.152647 2023] [mpm
英文:
I have a problem with my XAMPP installation, basically i have installed XAMPP with php7 and later added php8 to it. both are running perfectly on different ports. now i am trying to open socket extension but it gives error
> Call to undefined function socket_create()
but on command line(through php7 and php8) it is executing without any error and when i try to execute same script from web browser it gives me error that
> "Call to undefined function socket_create()"
i checked the available extension with the "get_loaded_extensions" function and on php7 it gives the following list (through command line)
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => bz2
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => openssl
[28] => curl
[29] => fileinfo
[30] => gd
[31] => gettext
[32] => mbstring
[33] => exif
[34] => mysqli
[35] => pdo_mysql
[36] => pdo_sqlite
[37] => sockets
[38] => Phar
[39] => ftp
and following extensions through php8 (command line)
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => bz2
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => openssl
[28] => curl
[29] => fileinfo
[30] => gd
[31] => gettext
[32] => mbstring
[33] => exif
[34] => mysqli
[35] => odbc
[36] => Phar
[37] => pdo_mysql
[38] => pdo_sqlite
[39] => soap
[40] => sockets
[41] => xsl
[42] => ftp
but when i ran same script through web browser it gives my following extensions
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => Phar
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => apache2handle
which are less than both versions.
I have already enabled the socket extensions in both PHP.ini files
extension=sockets
Here is the error data from error.log file and php_error.log file is empty
> [Sat May 13 12:02:41.037386 2023] [ssl:warn] [pid 4192:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.095157 2023] [core:warn] [pid 4192:tid 592] AH00098: pid file D:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat May 13 12:02:41.102153 2023] [ssl:warn] [pid 4192:tid 592] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.145647 2023] [mpm_winnt:notice] [pid 4192:tid 592] AH00455: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.6 configured -- resuming normal operations
[Sat May 13 12:02:41.145647 2023] [mpm_winnt:notice] [pid 4192:tid 592] AH00456: Apache Lounge VC15 Server built: Dec 23 2021 11:00:40
[Sat May 13 12:02:41.145647 2023] [core:notice] [pid 4192:tid 592] AH00094: Command line: 'd:\xampp\apache\bin\httpd.exe -d D:/xampp/apache'
[Sat May 13 12:02:41.152647 2023] [mpm_winnt:notice] [pid 4192:tid 592] AH00418: Parent: Created child process 2388
[Sat May 13 12:02:41.878106 2023] [ssl:warn] [pid 2388:tid 600] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.940553 2023] [ssl:warn] [pid 2388:tid 600] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 13 12:02:41.998518 2023] [mpm_winnt:notice] [pid 2388:tid 600] AH00354: Child: Starting 150 worker threads.
Any leads from where i can debug or eliminate this error?
答案1
得分: 0
I came to know that my apache is not loading the Configuration File of PHP. @IMSoP's comment give me lead to check from this angle.
当我检查了 phpinfo()
输出时,它显示了以下配置。
Configuration | Value |
---|---|
Loaded Configuration File | (none) |
after some searching found a solution on StackEchange, I have to add below lines to my apache config file (httpd.conf
) which is located in Directory:\xampp\apache\conf\httpd.conf
. The below lines actually tells apache to load PHP configuration file from installation directory, in my case it is d:\xampp\php\php.ini
.
LoadModule php8_module c:/php/php8apache2_4.dll
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "D:\xampp\php\php.ini"
英文:
I came to know that my apache is not loading the Configuration File of PHP. @IMSoP's comment give me lead to check from this angle.
When i checked the phpinfo()
output it shows me below configuration.
Configuration | Value |
---|---|
Loaded Configuration File | (none) |
after some searching found a solution on StackEchange, I have to add below lines to my apache config file (httpd.conf
) which is located in Directory:\xampp\apache\conf\httpd.conf
. The below lines actually tells apache to load PHP configuration file from installation directory, in my case it is d:\xampp\php\php.ini
.
LoadModule php8_module c:/php/php8apache2_4.dll
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir ""D:\xampp\php\php.ini""
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论