php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75618 embed sapi can not compile
Submitted: 2017-12-04 08:45 UTC Modified: 2017-12-04 14:47 UTC
From: jsntzhuhu at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 7.2.0 OS: Linux Mint
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jsntzhuhu at gmail dot com
New email:
PHP Version: OS:

 

 [2017-12-04 08:45 UTC] jsntzhuhu at gmail dot com
Description:
------------
simple sapi code can't link.

same as https://bugs.php.net/bug.php?id=48911 




Test script:
---------------
#include "sapi/embed/php_embed.h"
int main( int argc , char ** argv){
	PHP_EMBED_START_BLOCK(argc,argv);
	
	PHP_EMBED_END_BLOCK();
	return 0;
	
}


gcc -Iphp7/include/php	-Iphp7/include/php/main -Iphp7/include/php/Zend -Iphp7/include/php/TSRM -Wall -g -lstdc++ -lphp7 -Lphp7/lib ukcframe.c -o ukcframe

Expected result:
----------------
compile success

Actual result:
--------------
ukcframe.c:6: undefined reference to `php_embed_init'
ukcframe.c:6: undefined reference to `executor_globals'
ukcframe.c:6: undefined reference to `executor_globals'
ukcframe.c:6: undefined reference to `executor_globals'
ukcframe.c:8: undefined reference to `executor_globals'
ukcframe.c:8: undefined reference to `executor_globals'
ukcframe.c:8: undefined reference to `php_embed_shutdown'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-04 14:37 UTC] jsntzhuhu at gmail dot com
sorry, this is not problem , just !!! compile method !!!

gcc ukcframe.c -o ukcframe -Iphp7/include/php	-Iphp7/include/php/main -Iphp7/include/php/Zend -Iphp7/include/php/TSRM -Wall -g -lstdc++ -lphp7 -Lphp7/lib 

It's ok .  

cmd line 's order is wrong .
 [2017-12-04 14:43 UTC] jsntzhuhu at gmail dot com
chinese version ,suggest for chinese.

这个问题困扰了半天,因为这个问题在前面的bugs中也有出现
团队提示是更新过了代码。所以怀疑是php本身的问题在php7
中再次出现。也就没细想,这个命令行是php embed教程中的
所以也没有怀疑其真实性。
所以这个问题的核心就是把 源文件名 紧跟gcc 其他参数向
后排就可以解决这个问题。

还好发现的早,没有浪费社区人力。为占用社区资源表示抱歉。
 [2017-12-04 14:47 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-12-04 14:47 UTC] requinix@php.net
.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC