Re: [PHP-DEV] Can't use embeded sapi

2009-08-09 Thread Farley Knight
On Mon, Jul 13, 2009 at 7:17 PM, Paul Biggarpaul.big...@gmail.com wrote:
 Hi Thomas,

 On Mon, Jul 13, 2009 at 9:15 PM, Thomas Kochtho...@koch.ro wrote:
 gcc  -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
 I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall -g -o
 worker.o worker.c
 gcc  -L/usr/local/lib -lphp5 -o worker worker.o
 worker.o: In function `main':
 /var/checkouts/gearman-php-worker/worker.c:5: undefined reference to
 `php_embed_init'
 /var/checkouts/gearman-php-worker/worker.c:6: undefined reference to
 `php_embed_shutdown'
 collect2: ld returned 1 exit status
 make: *** [all] Error 1

 This worked for me, with your commands and program. Since its a linker
 error, it seems likely that you haven't installed libphp5.so properly.
 You didn't indicate that you ran make install, did you? If so, you may
 want to verify that there is a libphp5.so in /usr/local/lib, and that
 it is a shared library.



I don't think Thomas is completely off here.. For most of the morning
I've been trying to compile 5.3.0:

make clean; ./configure --enable-embed=shared; make  sudo make install

But when I went to build

#include sapi/embed/php_embed.h

int main(int argc, char *argv[]) {
  PHP_EMBED_START_BLOCK(argc, argv);
  PHP_EMBED_END_BLOCK();

  return 0;
}

using

gcc -o embed_test embed_test.c -I/usr/local/include/php/
-I/usr/local/include/php/main -I/usr/local/include/php/Zend
-I/usr/local/include/php/TSRM -L/usr/local/lib -lphp5

I kept getting

/tmp/cc9OgNuw.o: In function `main':
embed_test.c:(.text+0x21): undefined reference to `php_embed_init'
embed_test.c:(.text+0x65): undefined reference to `php_embed_shutdown'

However, when I run config and make for 5.2.10, the test file compiles
just fine. Something must have changed between the two versions... Not
sure what, though.. Probably will dig deeper into this..

Thanks,
- Farley

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Can't use embeded sapi

2009-08-09 Thread Scott MacVicar

On 9 Aug 2009, at 22:52, Farley Knight wrote:

On Mon, Jul 13, 2009 at 7:17 PM, Paul Biggarpaul.big...@gmail.com  
wrote:

Hi Thomas,

On Mon, Jul 13, 2009 at 9:15 PM, Thomas Kochtho...@koch.ro wrote:

gcc  -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall - 
g -o

worker.o worker.c
gcc  -L/usr/local/lib -lphp5 -o worker worker.o
worker.o: In function `main':
/var/checkouts/gearman-php-worker/worker.c:5: undefined reference to
`php_embed_init'
/var/checkouts/gearman-php-worker/worker.c:6: undefined reference to
`php_embed_shutdown'
collect2: ld returned 1 exit status
make: *** [all] Error 1


This worked for me, with your commands and program. Since its a  
linker
error, it seems likely that you haven't installed libphp5.so  
properly.
You didn't indicate that you ran make install, did you? If so, you  
may

want to verify that there is a libphp5.so in /usr/local/lib, and that
it is a shared library.




I don't think Thomas is completely off here.. For most of the morning
I've been trying to compile 5.3.0:

make clean; ./configure --enable-embed=shared; make  sudo make  
install


But when I went to build

#include sapi/embed/php_embed.h

int main(int argc, char *argv[]) {
 PHP_EMBED_START_BLOCK(argc, argv);
 PHP_EMBED_END_BLOCK();

 return 0;
}

using

gcc -o embed_test embed_test.c -I/usr/local/include/php/
-I/usr/local/include/php/main -I/usr/local/include/php/Zend
-I/usr/local/include/php/TSRM -L/usr/local/lib -lphp5

I kept getting

/tmp/cc9OgNuw.o: In function `main':
embed_test.c:(.text+0x21): undefined reference to `php_embed_init'
embed_test.c:(.text+0x65): undefined reference to `php_embed_shutdown'

However, when I run config and make for 5.2.10, the test file compiles
just fine. Something must have changed between the two versions... Not
sure what, though.. Probably will dig deeper into this..




This fixed in SVN already, the visibility for the two functions  
stopped them being exposed in the library.


Scott


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Can't use embeded sapi

2009-07-13 Thread Thomas Koch
Sorry for being a C newby. Could you please help me? I try to follow Sarah's 
extending PHP book and fail to use the embeded PHP sapi:

I compile PHP5.3:
./configure --enable-embed

have a c program:
#include sapi/embed/php_embed.h

int main(int argc, char *argv[]) 
{ 
PHP_EMBED_START_BLOCK(argc,argv) 
PHP_EMBED_END_BLOCK() 
return 0; 
}

and a makefile:
CC=gcc 
CFLAGS=-c -I/usr/local/include/php/ \
-I/usr/local/include/php/main \
-I/usr/local/include/php/Zend \
-I/usr/local/include/php/TSRM \
-Wall -g 
LDFLAGS=-L/usr/local/lib -lphp5
all: worker.c 
$(CC) -o worker.o worker.c $(CFLAGS)
$(CC) -o worker worker.o $(LDFLAGS)


and get after running make:
gcc  -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall -g -o 
worker.o worker.c
gcc  -L/usr/local/lib -lphp5 -o worker worker.o
worker.o: In function `main':
/var/checkouts/gearman-php-worker/worker.c:5: undefined reference to 
`php_embed_init'
/var/checkouts/gearman-php-worker/worker.c:6: undefined reference to 
`php_embed_shutdown'
collect2: ld returned 1 exit status
make: *** [all] Error 1







Thomas Koch, http://www.koch.ro

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Can't use embeded sapi

2009-07-13 Thread Edward Z. Yang
Excerpts from Thomas Koch's message of Mon Jul 13 16:15:10 -0400 2009:
 worker.o: In function `main':
 /var/checkouts/gearman-php-worker/worker.c:5: undefined reference to 
 `php_embed_init'
 /var/checkouts/gearman-php-worker/worker.c:6: undefined reference to 
 `php_embed_shutdown'
 collect2: ld returned 1 exit status

My guess is that you're missing some includes that you may need.  Double
check your code against that in the book.

Cheers,
Edward

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Can't use embeded sapi

2009-07-13 Thread Paul Biggar
Hi Thomas,

On Mon, Jul 13, 2009 at 9:15 PM, Thomas Kochtho...@koch.ro wrote:
 gcc  -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
 I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall -g -o
 worker.o worker.c
 gcc  -L/usr/local/lib -lphp5 -o worker worker.o
 worker.o: In function `main':
 /var/checkouts/gearman-php-worker/worker.c:5: undefined reference to
 `php_embed_init'
 /var/checkouts/gearman-php-worker/worker.c:6: undefined reference to
 `php_embed_shutdown'
 collect2: ld returned 1 exit status
 make: *** [all] Error 1

This worked for me, with your commands and program. Since its a linker
error, it seems likely that you haven't installed libphp5.so properly.
You didn't indicate that you ran make install, did you? If so, you may
want to verify that there is a libphp5.so in /usr/local/lib, and that
it is a shared library.



Paul


-- 
Paul Biggar
paul.big...@gmail.com

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php