Jump to content

str_getcsv simple question


myrddinwylt

Recommended Posts

Hello,

 

Could someone please assist me with a small problem.

 

PHP Version 5.2.8

PHP Configuration Information/ extensions, etc

 

I am getting the message

Fatal error: Call to undefined function str_getcsv()

 

There doesn't appear to be any documentation about what extension is required to be loaded on Google, PHP.net, PHP Usergroups, or even these forums (i do search before posting).

 

As this function was released prior to 5.x, I do not believe it is a problem with the version of PHP.

 

Could someone please either link a site where I can search a function and it tells me what extension needs to be loaded, or how to enable support in PHP for this function.

 

Thank you.

Link to comment
Share on other sites

Thank you Ken,

 

I updated my PHP to 5.3.2 from php.net, however, now I have just lost a whole plethora of functions.

 

Curl being one of the foremost. Could you suggest somewhere where there is a precompiled version of PHP for Windows that has support for Curl, APC, Zend, adt, Curl, gd, uploadprogress, openssl, etc .  I have all of the extensions and they work with 5.2.8. I also note that there hasn't been a windows compile of the PECL extensions in a couple of years.

 

Or perhaps, more ideally, what I need on my end to compile my own edition of PHP with said extensions included.  (which compiler works best under which environment for windows compile).

 

Thanks again.

 

(i will continue to google while waiting for a reply)

Link to comment
Share on other sites

I understand that WAMP and such are fairly decent in a single server testing environment, however, this is live, and there are multiple domains and subdomains with multiple ssl configs, cgi/perl, rails, and .net support. I maintain Apache2.2 / MySQL / PHP updates manually and individually, scrutinizing them for potential security holes, and making sure that nothing "extra" is included, nor too many features such as MSSQL support when there will be no MSSQL.

 

The *amp projects are more intended for beginner users or test environments as it does not support the following without extensive modification:

 

1. Virtual Hosting

2. Virtual Hosting with SSL

3. Exclusion of Insecure extensions (a lot of the insecure extensions are pre-compiled into it)

4. Use of just a specific part (aka, PHP or MySQL or Apache) --- it is a complete solution.

 

My Developer box has Visual Studio 2010 installed, but I guess I will have to dig up Visual Studio 2008 so I can compile this as the following command:

 

C:\php>configure --enable-one-shot --disable-zts --enable-apache2-2filter  --enable-apache2-2handler --with-curl --enable-fileinfo --enable-mbstring --enable-mbregex  --with-openssl --with-sqlite3 --with-mysql --with-mysqli --enable-pdo  --with-pdo-mysql --with-pdo-mssql --with-pdo-odbc --with-pdo-sqlite --with-pdo-sqlite-external --enable-soap --with-sqlite --with-xmlrpc --with-xsl --enable-exif --enable-sockets --with-mhash --with-imap --enable-intl  --with-pspell --with-snmp

 

Returns the following message:

 

Saving configure options to config.nice.bat
Checking for cl.exe ...  <not found>
ERROR: MS C++ compiler is required

 

Which I assume is because it doesn't know what Microsoft named the new compile & linking application for Visual Studio 2010. That being said, it is safe to assume that it also doesn't know the correct paramter format for the newer compiler --- which makes no sense to me as php.net has VC9 editions of php for download.  Further frusterating, I have been following PHP since 2.x, and when they finally introduced windows binaries, they have never made a compile with simple support for GD, or Curl --- very common commands. Then they decided to up and scat with all the PeCL libraries now only available as source downloads. Most 3rd party compiles of PHP crash erratically, and the one that I found which I have been using for the last 7-8 months is very stable, with no support for the stuff I don't need or care for, plenty of support for the things I do, except this function, which as far as I can tell is much better and faster than writing a csv parser using php.

Link to comment
Share on other sites

Linux has just as many compile problems. More so, as every "flavor" has their own builds and limited supports for different versions of different compilers that all do the same thing, yet when one library is a fraction of a version different either through custom naming for the ego of the flavor build, or legitimate a different version, stuff just breaks.

 

This is why I use windows and generally, it is more secure, and the problem with libraries is near non-existant.

 

I ran through some tests, and the new 2010 edition of cl.exe does accept the exact same parameters as being requested.

 

I found my problem that the compiler isn't being found was simple as the path to cl.exe was not set in the PATH environment variable (2 second fix).

 

Once that was setup, it still wouldn't execute as it is missing mspdb80.dll (not missing as this would normally be called from the IDE so it was located in the IDE subfolder), which was also fixed by copying that file and it's dependancies to the /bin folder where cl.exe was located.

 

C:\Program Files\Microsoft Visual Studio 9\Common7\IDE

msobj80.dll
mspdb80.dll
mspdbcore.dll
mspdbsrv.exe

 

Now the compiler is running, but it looks like I forgot to check something off when installing Visual Studio.

 

C:\php>configure --enable-one-shot --disable-zts --enable-apache2-2filter  --enable-apache2-2handler --with-curl --enable-fileinfo --enable-mbstring --enable-mbregex  --with-openssl --with-sqlite3 --with-mysql --with-mysqli --enable-pdo  --with-pdo-mysql --with-pdo-mssql --with-pdo-odbc --with-pdo-sqlite --with-pdo-sqlite-external --enable-soap --with-sqlite --with-xmlrpc --with-xsl --enable-exif --enable-sockets --with-mhash --with-imap --enable-intl  --with-pspell --with-snmp
Saving configure options to config.nice.bat
Checking for cl.exe ...  <in default path>
  Detected compiler MSVC9 (Visual C++ 2008)
  Detected 32-bit compiler
Checking for link.exe ...  C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
Checking for nmake.exe ...  <in default path>
Checking for lib.exe ...  <in default path>
Checking for bison.exe ...  <not found>
ERROR: bison is required

 

Thank you for answering my original question as that seems to have solved that issue (but created more headaches), however I must ask this from you.

 

How come anytime someone posts about compiling apache, php, mysql, etc etc, on Windows, which when I do find out the documentation on parameters it really is much simpler than linux, that people in general suggest to use *amp project, or "why do you want to compile on windows, just download the binaries from php.net" ...  yet... those binaries suck --  they have no GD support, and no Curl support, and no OpenSSL support which from where I stand there is no reason NOT to have them included as the compiling process is as simple as adding --with-curl --with-gd --with-openssl  or whatever. Those are very commonly used libraries, and that 9 times out of 10 is why someone would even consider compiling their own edition is because the official ones are lacking.  Linux builds you are also mostly at the whim of the OS flavor as to what you can or can't have unless you are lucky enough to have a build with all the exact versions of everything required in the compile process (this has been improving over the years, however it is still quite a chore, reverting versions of stuff, upgrading to new versions not in the repos, making sure all the compilers are the exact ones needed ...  and some flavors that process reverts right back to the kernel having to be recompiled, as the kernel itself was missing something that something else down the chain is depending on to work -- for that specific version ...  and forcing compiles is very buggy...  works sometimes, but with lots of problems).

 

So if you can answer that, just out of curiosity.  I assume it's generally the following:

 

1. People believe that everything on linux is so much smoother.

2. *amp is supposed to be the end all and be all solution for windows in every circumstance.

 

I am not really sure, but those 2 pop in my head first, and that type of response generally creates more frustration as it isn't really an answer to the question. Nor is it really a solution -- it is another problem, and an answer to a different question.  For example; if the user asks "which operating system would you recommend", then "linux" would be a fair answer.

 

I have nothing against linux, and although it has come very far over the last 10 years, it still has a way to go before I would consider using it for mainstream. Apache / Linux is a nice setup if you compile your own OS, and remove the junk code, it can make a really nice server. Is it more stable than windows ? That is something to be said -- if you mess with your windows server all the time or use it as a desktop, then yes, you will have lots of problems, if you install and cut to the minimums, locking everything down, and only use it as a server (not a web browser), then you should be fine unless some hardware fails (also something linux is prone to). Does it consume more resources ---  perhaps, but I have only ever seen 2 threads of apache running on windows no matter how many users were connected --- linux ... many many threads.... 

 

Linux makes an amazing VoIP server using Asterisk! Or basic webserver using any flavor. Custom stuff, or securing requires much more knowledge to the extent of compiling your own distro.

 

Also, when you need to update something for security, or for a new feature, windows has it hands down (even though Ubuntu is really coming close)

Link to comment
Share on other sites

I mentiond xampp and wamp in my response because you asked about precompiled PHP for Windows. You did not say anything about how you were using it, that came later.

 

I think most people suggest Linux over Windows because that's what they're used to. And they believe "Window == insecure" & "Linux == more secure" -- not necessarily true. If I wanted a very secure platform for the web, I would like to use OpenVMS, but, unfortunately, the versions of Apache, PHP, & MySQL are not up to date on that OS.

 

Ken

Link to comment
Share on other sites

The GD and curl extension .dll files COME with the Windows binary distribution. There is no need to compile them or php in order to use them. You must simple make sure that php can find the ext folder and enable them in the php.ini.

 

Edit: Likewise for openssl.

Link to comment
Share on other sites

PFMaBiSmAd,

 

I downloaded the windows binaries zip file, which contains a fraction of what comes pre-compiled with the Installer (now WIX) edition, or the Linux download.

 

Even though the extension "php_curl.dll" is there, and is being loaded without error on start, it doesn't work. I believe this is because Curl support was not compiled directly into PHP, as it was with the other edition I have (3rd party custom compile of 5.2.8)

 

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
;extension=php_mhash.dll
extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
extension=php_openssl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pdo_ibm.dll
;extension=php_pdo_informix.dll
;extension=php_pdo_user.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

 

The path is correct, and the libraries are found, otherwise, I would get all kinds of errors when starting apache, or browsing to the page (as apache now ignores startup errors), and PHP would fail to work in general rather than posting "undefined function".

 

One other possibility, I guess, would be, did they change / remove "curl_init"  from functions ?  According to http://ca.php.net/manual/en/function.curl-init.php it isn't deprecated, or anything like that.

 

(also, as a side not on compiling on windows, I really don't like Cygwin as it messes things up terri-bad, you wouldn't happen to know what I need to do or what versions of native exe's i need for bison.exe, etc... or if this is something that should have been installed with VS?. I know Visual Studio has an option built in it's IDE for using bison etc without those exe's, but the command line seems to require, and since there is no Project group, i don't dare at guessing the order of compile, and additional params to be set from within the IDE. I have this http://unxutils.sourceforge.net/, but seems to be quite dated, and would be nice to have a more recent project which doesn't require some custom shell layering over windows like Cygwin, and some others do).

 

Thanks.

Link to comment
Share on other sites

Are you sure curl is not working because the libeay32.dll, ssleay32.dll auxiliary files are not present, not of the same version as your php package, or not on the Windows path and/or the openssl extension is needed by your code as well and/or the allow_url_fopen setting is not on?

Link to comment
Share on other sites

Hello,

 

Positive, that was not the reason.  See, small problem with these distros, php should be installed in the same path where the apache bin is for optimal integration.  Apache 2.2.15 with SSL support includes libeay32, and whatnot, and so does php.  Also, MySQL requires that exact edition of libmysql.dll, and such to be in the php folder.

 

Anyway, I have all of this stuff working PROPERLY using apache 2.2.15, MySQL 5.2, and php 5.2.8 with ALL extensions loadable.

 

Was just hoping that there would be a simple way to upgrade to 5.2.3 for the new functions, optimizations, etc, but alas....  distro is still poo, and I don't remember who I got to help me with a PROPER WINDOWS compile.  PHP 5.3.2 is clearly different to compile, and the distro doesn't work (try to load php_mhash.dll, or php_mbstring.dll for example --- epic fails....  EVEN ON A BOX WITH NOTHING BUT PHP!!!!  Uncomment only php_mbstring.dll,  crash!!).

 

It would seem that the mystery of having a decent production copy of PHP remains unsolved almost a decade since PHP was released.  --- And still.....  "why not just download the zip" .... or  "why do you want to compile on windows" ... well... my rehtoric is....  "why does the source not include everything needed to compile" .....  and .....  "why do YOU want to compile on linux" ...  the answers to those questions, well... they don't really answer the real question!

 

Compile PHP on Windows with ALL Necessary support!!  PECL is horribly outdated windows compiles, the PHP sources do not contain all the libraries needed to compile (libpng, libjpg, etc) -- nor does any documentation state where and how those libraries are to be included / located .... not to mention downloading them 1 by 1 ....  seriously....  why such a friggin headache ?....  The compile CAN be done ... in fact... it's done automatically on php.net, just they are jerks who don't want to release the code and / info on how it is being done.

 

I can compile a kernel faster and easier than this!!!  Hell, I can compile the entire sources for Windows CE easier ....  I'm seriously pissed about this man as I keep coming back to the same problem and still, no one has resolved it where there are hundreds of thousands of people asking this very same thing ....  The documentation seriously blows when it comes to this.

 

I will give you an example on good compile information: Google for How to compile ManGOS for Windows.  It's simple... and same instructions.....  Install VC 2008 express or whatever edition + windows sdk --- download source from svn.... open project file....  select Release ... then Build Project.  And what do you know....  IT WORKS!! ...  Do the same instructions for PHP ... well... no project file....  it wants bison.exe, and other weird stuff as well... ok... so you get those.  Now you try to compile, and whats this... almost every extension is missing a library.  FAIL!!!

 

All those libraries are open source, and any distro of sources should include at least the libraries of what was needed and/or instructions where to get them and where they should be placed in the source tree and/or any other source changes that may be required to do this. ---- But it doesn't.

 

I'm just gonna roll back to PHP 5.2.8 and to hell with 5.3+++++++

 

Faster to write any of the "new" functions myself, and i can live with a few bugs.  I may even switch back to .NET since PHP still can't get their damn act together.  Would miss apache, but hey.... 99% of my headache would be gone with buggy lacking distro's.

 

Rant aside, any help in getting this job done would be appreciated.  And if done well enough, I would even be willing to cut a cheque!!  Convince PHP.net to make a proper ZIP distro ----  even better !! ... 

 

Peace out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.