# simplexml - Functions not Found



## rtwingfield (Oct 9, 2013)

I've installed simplexml-1.0.1.  Regarding the following scenario, any attempt to call a function from a PHP Version 5.4.20 script results in a fatal error:

`# php test_simplexml.php`

```
// test_simplexml.php

<?php
$xml = simplexml_load_string($xmlstring);
?>
```


```
Fatal error: Call to undefined function simplexml_load_string() in [FILE]test_simplexml.php[/FILE] on line 4
```
phpinfo() reveals the following:

```
XML Support     	active
XML Namespace Support 	active
libxml2 Version 	2.8.0
```
. . .but not SimpleXML support!  (...which I do find in another installed PHP Version 5.2.17 on another server.)

I've already recompiled PHP, but I did not see a configuration option to specify simplexml support, re. the following:

`# make config`

```
â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ php5-5.4.20 â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”

[x] CLI        Build CLI version 
[x] CGI        Build CGI version 
[ ] FPM        Build FPM version 
[x] APACHE     Build Apache module 
[x] AP2FILTER  Use Apache 2.x filter interface (experimental) 
[ ] EMBED      Build embedded library 
[ ] DEBUG      Enable debug 
[ ] DTRACE     Enable DTrace support 
[x] IPV6       Enable ipv6 support                                       
[ ] MAILHEAD   Enable mail header patch                                   
[x] LINKTHR    Link thread lib (for threaded extensions)                
[ ] ZTS        Force Zend Thread Safety (ZTS) build
```
Is there another _configuration_ scenario that I'm overlooking?


----------



## rtwingfield (Oct 9, 2013)

*Problem with Makefile(s)*

*Solution:*

To Makefile in the CONFIGURE_ARGS= \ container, add:

```
--enable-simplexml \
```

Makefile.ext already contains (and. . .not sure why the following doesn't accomplish the same):


```
.if ${PHP_MODNAME} == "simplexml"
CONFIGURE_ARGS+=--enable-simplexml \
                --with-libxml-dir=${LOCALBASE}
```
I don't know where the Makefile.ext is pickuped in the build process, but as noted regarding the addition to Makefile, after deinstall and reinstall (`# make build install clean`), the support for simplexml is available as evidenced below from phpinfo():


```
Simplexml support => enabled
Revision => $Id: 2358f2be6570ab413d0ead3a931a5365adf94af9 $
Schema support => enabled
```


----------



## freethread (Oct 9, 2013)

The port lang/php5-extensions should be installed too. Go to /usr/ports/lang/php5-extensions and run

`# make config`

The SIMPLEXML option shoud be checked, if not, check it and rebuild this port.


----------



## rtwingfield (Oct 9, 2013)

Extensions . . .hum, silly me.  It's been several years since I compiled PHP Version 5.2.17, but if I were writing the Makefile for PHP v5.4.20 (_current_), I'd include a call to the php5-extensions Makefile (to make sure that people like me don't forget about it).



Hey, thanks for the heads-up


----------



## freethread (Oct 9, 2013)

rtwingfield said:
			
		

> Extensions . . .hum, silly me.  It's been several years since I compiled PHP Version 5.2.17, but if I were writing the Makefile for PHP v5.4.20 (_current_), I'd include a call to the php5-extensions Makefile (to make sure that people like me don't forget about it).
> 
> 
> 
> Hey, thanks for the heads-up



Ahahah, I don't remember when and how I discovered this, initially also I was stuck with extensions. Some extensions are not listed in that port: devel/php-xdebug for example is not in the list and don't have 'php5-' prefix. Anyhow, for ports listed in lang/php5-extensions, when you install an extension without using this port, but listed in it, after installation you can check the options and you will see it checked, so you can install each single extension or recheck options and reinstall the lang/php5-extensions port, it's a meta-port, not really a port.

This meta-port maintain the extensions configuration files in /usr/local/etc/php/extensions.ini, it doesn't touch php.ini. If you want things go automatic, don't edit this file, add and remove extensions by meta-port. For xdebug I initially manually inserted it there after installation, but now I insert it in main php.ini (after the commented extensions list), also it's not a 'standard' extension, perhaps you insert it as zend extension.

I hope I was clear with my stray english.


----------



## rtwingfield (Oct 10, 2013)

Thanks yet again!

BTW, I once heard that the Russians have a "saying": 


> A person that speaks three languages is tri-lingual;
> a person that speaks two languages is bi-lingual; and . . .
> a person that speaks one language is [USA] American




Also, I've visited Italia twice (Tuscany) . . .beautiful country and great people!  As we speak, I'm having a glass of Mezzacorona Pino Grigio, vigneti delle dolomiti IGI.


----------



## freethread (Oct 10, 2013)

rtwingfield said:
			
		

> Thanks yet again!
> 
> BTW, I once heard that the Russians have a "saying":
> 
> ...



 cheers (cin cin) then


----------

