I'm trying to build php_perl.dll and am getting errors, but my understanding of building these extensions is limited (obviously). So i need to get this compiled, or, alternatively, point me to a pre-built php_perl.dll that will work with PHP 5.2.17. The http://pecl4win.php.net site is dead, and what little i can find at http://pecl.php.net/package/perl isn't much help either.
I've installed Perl (tried 64bit then x86), PHP (installed with XAMPP), and Visual Studio 6. Windows 7 64bit. PERL_HOME set to c:\perl.
This command
msdev perl.dsp /MAKE "perl - Win32 Release_TS"
Results in 102 errors, like this:
--------------------Configuration: perl - Win32 Release_TS--------------------
Compiling...
php_perl.c
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 'win32_accept'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ';'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2146: syntax error : missing ')' before identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2061: syntax error : identifier 's'
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ','
C:\Perl\lib\CORE\sys/socket.h(72) : error C2059: syntax error : ')'
...
C:\Perl\lib\CORE\sys/socket.h(98) : error C2059: syntax error : ')'
C:\Perl\lib\CORE\win32.h(420) : error C2079: 'Wservent' uses undefined struct 'servent'
C:\Perl\lib\CORE\iperlsys.h(1143) : error C2143: syntax error : missing ')' before '*'
C:\Perl\lib\CORE\iperlsys.h(1143) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
php_perl.dll - 102 error(s), 0 warning(s)
Any ideas on what i'm doing wrong?
No answer for this question?
I just resolved compilation errors for php 5.3.13 on Windows by slightly modifying the new 1.0.1 php_perl.c source code (line 31):
old:
# define _WINSOCK2API_ /* using winsock.h instead of winsock2.h */
new:
# ifndef _WINSOCK2API_
# include <winsock2.h>
# endif
For the compilation follow the tutorial from this page (http:/ /www.crazyws.fr/tutos/compiler-php-et-ses-extensions-sur-windows-SJ5GT.html), sorry for the french.
Basically install Visual Studio 2008 Express WITH SP1 (otherwise a build error occurs), then uninstall any 2008 Runtime, then install the Windows SDK 6.1 (2008 Server) to compile VC9 builds. I also used a Perl installation from ActiveState (version 5.8.0, ActivePerl-5.8.0.805-MSWin32-x86.msi, not tested with further versions).
Then download the php sdk and deps from http:/ /windows.php.net/downloads/php-sdk/, php sources, sources of extension from http:/ /pecl.php.net/package/perl, unzip directories as described in the tutorial, modify php_perl.c as above.
Then open the CMD shell of the Windows SDK and type:
setenv /xp /x86 /release
cd <root_directory>
bin\phpsdk_setvars.bat
cd <php_src>
buildconf --force
configure --help
configure --with-perl=shared --with-extra-includes="<perl_lib_CORE_directory>" --with-extra-libs="<perl_lib_CORE_directory>"
nmake php_perl.dll
I compiled my dll on windows 7 Pro 64-bit and tested it on my WampServer installation. The .phpt files in the sources of the extension are pretty self-explanatory on how to use it.
For info another version of the file is also available for php 5.4 on this github repo (https:/ /github.com/do-aki/php-ext-perl).
Sorry for the long answer, but the README file of the extension regarding installation on Windows is obsolete and there is no support which I found pretty lame.
Regards
Related
I'm testing out php 7 and have come across this error:
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
From the doc page: http://php.net/manual/en/function.odbc-connect.php php 7 is not listed as supported.
Does anyone have a way around this or know when it will be supported?
Thanks#
There is written in doc: ODBC support doesn't need any extension dll. It is true in PHP 5.x, I had to remove "extension=php_odbc.dll" from ini file.
But in PHP 7 I had to put it back.
I found the file "ext/php_odbc.dll" in the new PHP 7 directory again. It works for me :).
The DOC page does list PHP 7, so just install php-odbc and you should be good to go. Currently using it myself on RedHat EL7 with Remi php7.
I ran into the same problem. However according to the link you provided PHP7 is in fact supported. So I'm not sure why you have so many comments telling you to go re-write your code.
This is what ultimately fixed the issue for me:
sudo apt-get install php-odbc
Followed by restarting Apache.
PHP 7.2.7, add extension=php_odbc.dll in php.ini file while either using database as MS Access or Sql Server
C:\xxxxxx\php\php.ini
*no semicolon before to extension=php_odbc.dll
Just enble "php_odbc.dll" extension by removing the semicolon and restart Apache.
If there is no such line in php.ini, simply create it on yourself (you will find many similar lines in php.ini) by adding: extension=php_odbc.dll and then restart Apache.
If Apache does not start or cannot load php_odbc.dll, look into to the ext-Folder of PHP, if there is such a DLL called php_odbc.dll. If there is no such DLL, Xampp/PHP7 does not support ODBC natively. In that case you should install an older Xampp Version with PHP 5.x
From php.ini file:
> ; Notes for Windows environments :
> ;
> ; - ODBC support is built in, so no dll is needed for it.
> ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
But, in PHP 7, ODBC is not by default. Explicit
extension=odbc
worked for me (new syntax recommended)
Edit:
If your architecture is x64
you must use C:\Windows\SysWOW64\odbcad32.exe
instead of C:\Windows\system32\odbcad32.exe
Here is the error message:
Redhat PHP Fatal error: Uncaught Error: Call to undefined function
odbc_connect()
On Redhat Linux 7 you run:
yum install php-odbc
You will get these packages marked in red:
Code sample to test your connection via php command line run: php [filename].php
<?php
// filename: test-connection.php by running command -> php test-connection.php
$connect = odbc_connect("Driver=FreeTDS; Server=sbase.company.ca; Port=1433; TDS_Version=8; ClientCharset=UTF-8; Database=mydbase",'company\\user', 'password');
$query = "SELECT * from mytable";
// perform the query
$result = odbc_exec($connect, $query);
// fetch the data from the database
while(odbc_fetch_row($result)){
$suid = odbc_result($result, 1);
$uid = odbc_result($result, 2);
$gid = odbc_result($result, 3);
$name = odbc_result($result, 4);
print("$name|$suid|$uid|$gid\n");
}
// close the connection
odbc_close($connect);
?>
Enjoy!
I downloaded the Google App Engine SDK for PHP but I am having problems with the installation of the PHP interpreter. I downloaded the source code from the link given but when I try to compile php the command make terminates with this error:
/bin/bash /home/david/Google/appengine-php-master/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/jsonc/ -I/home/david/Google/appengine-php-master/php-src/ext/jsonc/ -DPHP_ATOM_INC -I/home/david/Google/appengine-php-master/php-src/include -I/home/david/Google/appengine-php-master/php-src/main -I/home/david/Google/appengine-php-master/php-src -I/home/david/Google/appengine-php-master/php-src/ext/date/lib -I/home/david/Google/appengine-php-master/php-src/ext/ereg/regex -I/libxml2 -I/home/david/Google/appengine-php-master/php-src/ext/sqlite3/libsqlite -I/home/david/Google/appengine-php-master/php-src/TSRM -I/home/david/Google/appengine-php-master/php-src/Zend -I/include -g -O2 -fvisibility=hidden -c /home/david/Google/appengine-php-master/php-src/ext/jsonc/json.c -o ext/jsonc/json.lo
In file included from ext/jsonc/json-c/json_inttypes.h:5:0,
from ext/jsonc/json-c/json_object.h:16,
from ext/jsonc/json-c/linkhash.h:16,
from ext/jsonc/json-c/json.h:22,
from /home/david/Google/appengine-php-master/php-src/ext/jsonc/json.c:34:
ext/jsonc/json-c/json_config.h:2:23: fatal error: ../config.h: No such file or directory
#include "../config.h"
^
compilation terminated.
Makefile:725: recipe for target 'ext/jsonc/json.lo' failed
make: *** [ext/jsonc/json.lo] Error 1
In fact there is no such config.h file in that directory so I can't understand how to solve this problem.
So I decided to search online the source code of PHP 5.4.19 and I compiled and installed it and everything worked. I followed all the other installation steps and everything worked.
Now if I start the server with the command
google_appengine/dev_appserver.py --php_executable_path=/usr/local/bin/php-cgi --php_gae_extension_path=/home/david/Google/appengine-php-extension-master/modules/gae_runtime_module.so my_app/
I get:
INFO 2016-03-25 15:04:19,209 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2016-03-25 15:04:19,797 sdk_update_checker.py:257] The SDK is up to date.
INFO 2016-03-25 15:04:19,901 api_server.py:205] Starting API server at: http://localhost:51913
INFO 2016-03-25 15:04:19,907 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2016-03-25 15:04:19,909 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR 2016-03-25 15:04:21,270 php_runtime.py:348] The PHP runtime is not available
Traceback (most recent call last):
File "/home/david/Google/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path)
File "/home/david/Google/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 286, in _check_binaries
cls._check_gae_extension(php_executable_path, gae_extension_path, env)
File "/home/david/Google/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 241, in _check_gae_extension
ext_stdout))
_PHPEnvironmentError: "/usr/local/bin/php-cgi -m" returned an error [-6]
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/home/david/Google/appengine-php-extension-master/remote_api.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/home/david/Google/appengine-php-extension-master/remote_api.pb.cc".)
Accordingly to the message the problem should be in the version of libprotobuf9 library. I have that library installed in my system (ubuntu 15.04) and in fact the version is 2.6.1. But by following the installation steps I installed protoc-3.0.0-beta-2-linux-x86_64 and protobuf-3.0.0-beta-2 in /usr. So, why does appengine use the wrong version of the library?
I thought about removing libprotobuf9 from my system but if I run sudo apt-get remove libprotobuf9 the list of packages that need to be removed is very big and contains things like
gnome-bluetooth gnome-calculator gnome-contacts
gnome-disk-utility gnome-font-viewer gnome-keyring gnome-mahjongg gnome-mines gnome-orca gnome-power-manager gnome-screensaver
gnome-screenshot gnome-session-bin gnome-session-canberra gnome-sudoku gnome-system-log gnome-system-monitor gnome-terminal
to me it doesn't seem a good idea to remove them. What's the solution to my problem?
I am trying to install libgit2 and php-git. I've successfully downloaded and built libgit2.However, I face problem when I try to install php-git.
This is how I try to install it :
phpize
./configure --enable-git2-debug
make
make install
There's no problem with phpize. However, when I use make and make install, following errors are showed:
./php_git2.h:180:3: error: unknown type name 'git_smart_subtransport'
git_smart_subtransport *smart_subtransport;
./helper.h:58:42: error: unknown type name 'git_checkout_opts'; did you mean 'git_checkout_options'?
void php_git2_git_checkout_opts_to_array(git_checkout_opts *opts, zval **out TSRMLS_DC);
/usr/local/include/git2/checkout.h:295:3: note: 'git_checkout_options' declared here
} git_checkout_options;
^~~~~~~~~~~~~~~~~
./helper.h:62:41: error: unknown type name 'git_checkout_opts'; did you mean 'git_checkout_options'?
int php_git2_array_to_git_checkout_opts(git_checkout_opts **out, zval *array TSRMLS_DC);
^~~~~~~~~~~~~~~~~
git_checkout_options
and there are more errors. Why this happens?
These errors indicate that the header files for libgit2 do not correspond to the version which the PHP bindings expect.
The bindings have their own libgit2 version which they link statically, so it does not need/want to use a system-installed version, but this is where the header files are being read from (as indicated by the paths in the output).
It looks to be a bug in php-git that it reads system header files for libgit2, but that's the root of the issue. The bindings do not want you to install libgit2 on your system. Unless you need a system libgit2 for another purpose, removing it should fix the issue.
You should file a bug with the php-git project as failing to work when a version of libgit2 is installed on the system is a build system bug in its code.
I should have been clearer. Looks like it's not finding libgit2.
I'm testing out php 7 and have come across this error:
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
From the doc page: http://php.net/manual/en/function.odbc-connect.php php 7 is not listed as supported.
Does anyone have a way around this or know when it will be supported?
Thanks#
There is written in doc: ODBC support doesn't need any extension dll. It is true in PHP 5.x, I had to remove "extension=php_odbc.dll" from ini file.
But in PHP 7 I had to put it back.
I found the file "ext/php_odbc.dll" in the new PHP 7 directory again. It works for me :).
The DOC page does list PHP 7, so just install php-odbc and you should be good to go. Currently using it myself on RedHat EL7 with Remi php7.
I ran into the same problem. However according to the link you provided PHP7 is in fact supported. So I'm not sure why you have so many comments telling you to go re-write your code.
This is what ultimately fixed the issue for me:
sudo apt-get install php-odbc
Followed by restarting Apache.
PHP 7.2.7, add extension=php_odbc.dll in php.ini file while either using database as MS Access or Sql Server
C:\xxxxxx\php\php.ini
*no semicolon before to extension=php_odbc.dll
Just enble "php_odbc.dll" extension by removing the semicolon and restart Apache.
If there is no such line in php.ini, simply create it on yourself (you will find many similar lines in php.ini) by adding: extension=php_odbc.dll and then restart Apache.
If Apache does not start or cannot load php_odbc.dll, look into to the ext-Folder of PHP, if there is such a DLL called php_odbc.dll. If there is no such DLL, Xampp/PHP7 does not support ODBC natively. In that case you should install an older Xampp Version with PHP 5.x
From php.ini file:
> ; Notes for Windows environments :
> ;
> ; - ODBC support is built in, so no dll is needed for it.
> ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
But, in PHP 7, ODBC is not by default. Explicit
extension=odbc
worked for me (new syntax recommended)
Edit:
If your architecture is x64
you must use C:\Windows\SysWOW64\odbcad32.exe
instead of C:\Windows\system32\odbcad32.exe
Here is the error message:
Redhat PHP Fatal error: Uncaught Error: Call to undefined function
odbc_connect()
On Redhat Linux 7 you run:
yum install php-odbc
You will get these packages marked in red:
Code sample to test your connection via php command line run: php [filename].php
<?php
// filename: test-connection.php by running command -> php test-connection.php
$connect = odbc_connect("Driver=FreeTDS; Server=sbase.company.ca; Port=1433; TDS_Version=8; ClientCharset=UTF-8; Database=mydbase",'company\\user', 'password');
$query = "SELECT * from mytable";
// perform the query
$result = odbc_exec($connect, $query);
// fetch the data from the database
while(odbc_fetch_row($result)){
$suid = odbc_result($result, 1);
$uid = odbc_result($result, 2);
$gid = odbc_result($result, 3);
$name = odbc_result($result, 4);
print("$name|$suid|$uid|$gid\n");
}
// close the connection
odbc_close($connect);
?>
Enjoy!
thanks to Stof on IRC i know the answer now. I just wanted to share it, in case someone stumbles upon the same problem.
The problem
When you have field type datetime:
/**
* #ORM\Column(type="datetime", name="released_at")
*/
protected $released_at;
and in form type you use date form type:
$builder
->add('released_at', 'date', array(
'widget' => 'single_text',
'format' => 'yyyy-MM-dd',
));
and you're getting this error:
Fatal error: Call to a member function setLenient() on a non-object in (...)\vendor\symfony\src\Symfony\Component\Form\Extension\Core\Type\DateType.php on line 64
The solution is
Try this test
<?php
$formatter = new \IntlDateFormatter();
if($formatter === null)
echo 'null!';
else
echo 'else';
If you get null, it means your php / intl version is buggy and you need to upgrade.
In my case, I was running # Windows 7 64bit machine, Wampserver2 with PHP 5.3.8.
Upgradeing to PHP 5.3.10 or higher did the trick.
Also if you are getting:
(..path..)\StubIntlDateFormatter::setLenient() is not implemented. Please install the 'intl' extension for full localization capabilities.
upgrade to Symfony 2.0.16.
Cheers and once again, TYVM Stof!
I have two configurations, each with a different application:
- Windows 7 64bit machine, Wampserver2 with PHP 5.3.8 with Symfony 2.0.15 installed using composer
- Windows 7 64bit machine, Wampserver2 with PHP 5.3.8 with Symfony 2.1-RC1 installed from zip with vendors
On the first configuration I had the error:
Fatal error: Call to a member function format() on a non-object in C:\MyProject\vendor\symfony\src\Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer.php on line 97
On the second configuration I had the error:
Fatal error: Call to a member function setLenient() on a non-object in C:\MyProjectSf2.1\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\Core\Type\DateType.php on line 81
I upgraded only PHP from 5.3.8 to 5.3.13 in my WAMP2 installation using the files provided at the following place:
http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/
PHP 5.3.13 (Thread Safe) + Fixed curl extensions
and it fixed the issues on both applications !
A big thanks to Anindya for his effort offering 64bits compiled version of the PHP DLL, I didn't find an other 64bits version anywhere else !
( and as far as I have seen (I compared the version using Beyond Compare), it was his 5.3.8 64bits thread safe version included in the Wamp2 version I have ;)
Best regards,
Christophe
This happens if you don't have correct parameteres in your php.ini... Check if you have a correct configuration of time zone in your php.ini as "Europe/Brussels" (case sensitive)