I have a problem with Lighttpd, PHP and CGI.
I use OpenSUSE.10.
I have builded lighttpd (version 1.4.23) and php (version 5.3.0).
This is lighttpd build command lines:
./configure --prefix=/home/gosh/Desktop/web_server/lighttpd_native_installed --without-zlib --enable-ssl --enable-openssl --with-openssl=/home/gosh/Desktop/web_server/openssl_native_installed --with-openssl-includes=/home/gosh/Desktop/web_server/openssl_native_installed/include --with-openssl-libs=/home/gosh/Desktop/web_server/openssl_native_installed/lib --without-pcre --with-zlib --without-bzip2
make
make install
This is php build command lines:
./configure --prefix=/home/gosh/Desktop/web_server/php_native_installed --without-iconv --disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --enable-fastcgi --enable-force-cgi-redirect
make
make install
This is php, php-cgi -v:
gosh#suse:~/Desktop/web_server> /home/gosh/Desktop/web_server/php_native_installed/bin/php -v
PHP 5.3.0 (cli) (built: Aug 30 2009 03:56:22)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
gosh#suse:~/Desktop/web_server> /home/gosh/Desktop/web_server/php_native_installed/bin/php-cgi -v
PHP 5.3.0 (cgi-fcgi) (built: Aug 30 2009 03:55:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
gosh#suse:~/Desktop/web_server>
This is lighttpd.conf:
server.document-root = "/home/gosh/Desktop/web_server"
server.port = 81
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
index-file.names = ( "index.php" )
server.modules = (
"mod_fastcgi",
"mod_accesslog"
)
accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access0.log"
server.accesslog = "/home/gosh/Desktop/web_server/lighttpd_access000.log"
fastcgi.debug = 1
fastcgi.server = (
".php" =>
((
"bin-path" => "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini",
"socket" => "php.socket"
)),
".html" =>
((
"bin-path" => "/home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini",
"socket" => "php.socket"
))
)
$SERVER["socket"] == "127.0.0.1:443" {
server.document-root = "/home/gosh/Desktop/web_server"
ssl.engine = "enable"
ssl.pemfile = "/home/gosh/Desktop/web_server/lighttpd.pem"
server.errorlog = "/home/gosh/Desktop/web_server/lighttpd_error.log"
server.accesslog = "/home/gosh/Desktop/web_server/lighttpd_access1.log"
accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log"
}
This is command line to start lighttpd:
sudo /home/gosh/Desktop/web_server/lighttpd_native_installed/sbin/lighttpd -f /home/gosh/Desktop/web_server/lighttpd.conf -m /home/gosh/Desktop/web_server/lighttpd_native_installed/lib
And, finally, lighttpd creates lighttpd_error.log:
2009-08-30 04:44:01: (log.c.172) server started
2009-08-30 04:44:01: (mod_fastcgi.c.1365) --- fastcgi spawning local
proc: /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini
port: 0
socket php.socket
min-procs: 4
max-procs: 4
2009-08-30 04:44:01: (mod_fastcgi.c.1390) --- fastcgi spawning
port: 0
socket php.socket
current: 0 / 4
2009-08-30 04:44:01: (mod_fastcgi.c.1087) the fastcgi-backend /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini failed to start:
2009-08-30 04:44:01: (mod_fastcgi.c.1091) child exited with status 2 /home/gosh/Desktop/web_server/php_native_installed/php-cgi -c /home/gosh/Desktop/web_server/php.ini
2009-08-30 04:44:01: (mod_fastcgi.c.1094) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2009-08-30 04:44:01: (mod_fastcgi.c.1398) [ERROR]: spawning fcgi failed.
2009-08-30 04:44:01: (server.c.928) Configuration of plugins failed. Going down.
My questionis are:
1) has anybody successful experience in launching lighttpd + PHP + FastCGI on Ubuntu or OpenSUSE?
2) why spawning fcgi failed?
I.e. I want to use such index.php to test my web-server:
<? php
phpinfo();
?>
P.S.:
If I remove
$SERVER["socket"] == "127.0.0.1:443" {
server.document-root = "/home/gosh/Desktop/web_server"
ssl.engine = "enable"
ssl.pemfile = "/home/gosh/Desktop/web_server/lighttpd.pem"
server.errorlog = "/home/gosh/Desktop/web_server/lighttpd_error.log"
server.accesslog = "/home/gosh/Desktop/web_server/lighttpd_access1.log"
accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log"
}
from lighttpd.conf, lighttpd successfully starts and Firefox displays index.html (but not index.php):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Yabaaa!!!</title>
</head>
<body>
HELLO!!!
</body>
</html>
Update:
Thanks for the responses.
lighttpd_error.log exactly says that there is a problem with FCGI and PHP interpreter.
Yes, backports are available ion SUSE or Ubuntu, but they do NOT work too.
I think it is the OS problem.
I have embedded device:
CPU: AMD AU1000 (MIPS platform, not x86)
RAM: 64 MB
HDD: 120 GB
LAN: ethernet controller
Cross compiler to buils apps for this device:
mipsel-linux-gcc
So, I have builded Lighttpd and php for MIPS target, copied them to this device and... server started to work normally. I could see index.php from Mozilla!
I do not know why Lighttpd+PHP does not work on PC.
DECISION: I score on the problem.
If I remove
$SERVER["socket"] == "127.0.0.1:443" {
server.document-root = "/home/gosh/Desktop/web_server"
ssl.engine = "enable"
ssl.pemfile = "/home/gosh/Desktop/web_server/lighttpd.pem"
server.errorlog = "/home/gosh/Desktop/web_server/lighttpd_error.log"
server.accesslog = "/home/gosh/Desktop/web_server/lighttpd_access1.log"
accesslog.filename = "/home/gosh/Desktop/web_server/lighttpd_access2.log"
}
from lighttpd.conf, lighttpd
successfully starts and Firefox
displays index.html
This might be a different problem, here only concerning SSL and Logfiles.
Do these Logfiles exist?
Where's the information about your key-file for SSL?
I'd generally prefer the use of prebuilt-packages. Are there no backports available for SuSE or Ubuntu?
not sure, but most installation guides say that u should add this at the end of you php.ini
cgi.fix_pathinfo = 1
On ubuntu i have notice that the path setup for the php-cgi binary does not use the real binary name, ubuntu install php5-cgi were as the default configuration trys to point to php-cgi hence you get the above error. It had me guessing for a few minutes myself.
Related
If i use the CURLOPT_TCP_FASTOPEN option in my code , then i get the following error.
Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed
'CURLOPT_TCP_FASTOPEN'
The CURLOPT_TCP_FASTOPEN is a supported option in php 7.4.5 interface .
php -v
PHP 7.4.5 (cli) (built: Apr 14 2020 12:54:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.5, Copyright (c), by Zend Technologies
curl -V
curl 7.70.0 (x86_64-redhat-linux-gnu) libcurl/7.70.0 NSS/3.44 zlib/1.2.7 libpsl/0.7.0 (+libicu/50.1.2) libssh2/1.9.0 nghttp2/1.31.1
Release-Date: 2020-04-29
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB PSL SPNEGO SSL UnixSockets
What am i doing wrong here ?
Edit 1:
Here are additional info corresponding to YouriKoeman's overview
Kernel version : 3.10.0-1062.12.1.el7.x86_64
OS : unix (Centos 7.x)
curl --tcp-fastopen -L http://www.google.com return the following error:
curl: (55) Send failure: Operation not supported for curl --tcp-fastopen -L http://www.google.com
I chose to answer in a more broad way to hopefully help more poeple when they encounter issues relating to this and google for answers
(Note: php runtime and Loaded extensions can differ between the CLI and when accessed from a webserver).
What are the system requirements for this feature?
The feature CURLOPT_TCP_FASTOPEN you want to use has some system requirements that have to be met
They are the following:
You must have Kernel version > 3.6 (linux)
You must have PHP 7.0.7 or higher
You must have Curl(program) AND php{your/version}-curl 7.49.0 or higher
You must have a *nix type of operating system (macos, linux, bsd)
how to debug What requirement is not being met?
The fact that the constant is not defined is a red flag that one of these dependencies is not met, but how do i figure out which?
kernel version
This one is easy, run the following command:
uname -r.
It must be greater than 3.6
Curl version and build options
The best way to check if the functionality is available in curl is to call curl from the cli with this option, like:
curl --tcp-fastopen -O http://google.com
If this request goes successfully, curl is configured correctly on your system, so the problem lies within php
PHP version and extensions
For webserver
use phpinfo() to check if the php version is greater than 7.0.7 And that the php-curl extensions are loaded
For CLI
in the command line type php -v the version should be greater than 7.0.7.
To check the extensions type the following into your command line php -m | grep curl this command should return curl, if nothing is returned the curl extension is not loaded for the php cli.
The issue was that tcp fast open is not enabled by default until kernel version 3.13.
To enable TCP Fast Open on Centos 7:
1.Add tcp_fastopen in sysctl.d
echo "net.ipv4.tcp_fastopen=3" > /etc/sysctl.d/30-tcp_fastopen.conf
2.Restart sysctl
systemctl restart systemd-sysctl
3.Verify sysctl setup for tcp_fastopen
cat /proc/sys/net/ipv4/tcp_fastopen should output 3
Apart from logging to the wrong file (the error log defined for that vhost defined last),
lighty does not let me use PHP 7. What am I missing?
cgi.fix_pathinfo is enabled in /etc/php/7.0/fpm/php.ini.
How can I make sure you're using the FastCGI-enabled version? What else should I look for?
version info (shrinked to the necessary)
> lsb_release -a
Description: Ubuntu 16.04.1 LTS
Codename: xenial
> lighttpd -v
lighttpd/1.4.35 (ssl) - a light and fast webserver
Build-Date: Apr 18 2016 15:36:10
> php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
> php-cgi -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cgi-fcgi)
> php-fpm7.0 -v
PHP 7.0.8-0ubuntu0.16.04.3 (fpm-fcgi)
lighty config file excerpt
> head -41 /etc/lighttpd/lighttpd.conf | tail -9
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"broken-scriptfilename" => "enable"
)))
tryouts
If I change the socket to an invalid path, restarting lighttpd works fine; but the server is unreachable. (bind failed for: (invalid path) in the error log); so this seems like the correct config file.
Modifying /etc/lighttpd/conf-available/15-fastcgi-php.conf in the same way has no effect at all.
Changing the socket to "/var/run/php/php7.0-fpm.sock" has no effect either (php_info() still says PHP 5.6 after restarting lighty).
After changing bin-path to /usr/sbin/php-fpm7.0 , I still get no error when restarting lighttpd, but the web server is unreachable.
error log excerpt
> tail /var/log/lighttpd/error.log
(no output)
> tail /var/log/lighttpd/somevhost/error.log
2016-10-10 16:48:02: (log.c.164) server started
2016-10-10 16:48:02: (mod_fastcgi.c.1112) the fastcgi-backend /usr/sbin/php-fpm7-0 failed to start:
2016-10-10 16:48:02: (mod_fastcgi.c.1116) child exited with status 2 /usr/sbin/php-fpm7-0
2016-10-10 16:48:02: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2016-10-10 16:48:02: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed.
2016-10-10 16:48:02: (server.c.1022) Configuration of plugins failed. Going down.
update
I just uninstalled php5 hoping this would resolve the issues; but that didnĀ“t help either. Instead, I seem to have no way to get php5 back.
Tried a search engine?
https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7
The first hit:
https://www.howtoforge.com/tutorial/installing-lighttpd-with-php7-php-fpm-and-mysql-on-ubuntu-16.04-lts/
suggests
## Start an FastCGI server for php (needs the php7.0-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php/php7.0-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
to go along with php.ini cgi.fix_pathinfo=1
You can follow the instructions on the page above to have Ubuntu run php7.0-fpm as a service, or you can configure lighttpd to start up the fastcgi.server backend by setting "bin-path" in the fastcgi.server definition, but do not do both.
I was hoping someone could help me out. I cannot get the memory_limit config setting to work on my PHP laravel install. Even something as simple as php artisan --help gives me a memory exhausted error.
I've tried modifying all my php.ini files, and specifying the config via the -d flag , but none of them seem to work. I feel like there's something else I'm missing?
Here's some shell output from my setup, please let me know if there's anything else you'd like to see.
vagrant#precise64:/vagrant/www$ uname -a
Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
vagrant#precise64:/vagrant/www$ php --version
PHP 5.4.33-2+deb.sury.org~precise+1 (cli) (built: Sep 25 2014 09:06:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
vagrant#precise64:/vagrant/www$ php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
vagrant#precise64:/vagrant/www$ php -i | grep memory_limit
memory_limit => -1 => -1
vagrant#precise64:/vagrant/www$ grep -r memory_limit /etc/php5/
/etc/php5/cli/php.ini:memory_limit = -1
/etc/php5/fpm/php.ini.ucf-dist:memory_limit = -1
/etc/php5/fpm/php.ini:memory_limit = -1
/etc/php5/fpm/pool.d/www.conf:php_admin_value[memory_limit] = -1
vagrant#precise64:/vagrant/www$ grep -r safe_mode /etc/php5/ | grep =
/etc/php5/cli/php.ini:sql.safe_mode = Off
/etc/php5/fpm/php.ini.ucf-dist:sql.safe_mode = Off
/etc/php5/fpm/php.ini:safe_mode = Off
/etc/php5/fpm/php.ini:safe_mode_gid = Off
/etc/php5/fpm/php.ini:safe_mode_include_dir =
/etc/php5/fpm/php.ini:safe_mode_exec_dir =
/etc/php5/fpm/php.ini:safe_mode_allowed_env_vars = PHP_
/etc/php5/fpm/php.ini:safe_mode_protected_env_vars = LD_LIBRARY_PATH
/etc/php5/fpm/php.ini:sql.safe_mode = Off
vagrant#precise64:/vagrant/www$ php artisan --help
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 3072 bytes) in /vagrant/www/app/controllers/TemplateController.php on line 44
Thanks so much in advance, I really have no idea what could be wrong.
This ended up being a weird problem with my routes.php from within Laravel. I had two controllers (WebhookController and TemplateController) specified as Route::controllers, and TemplateController again specified as a Route::resource.
This ended up causing the memory exhaustion errors for reasons I still can't figure out, but that's beside the point.
The fix was to manually specify the controller routes and not use Route::controller at all within my routes.php.
I'm trying to use vld to view opcode of a php file
prep
I've installed vld with:
pecl install channel://pecl.php.net/vld-0.12.0
To get familiar with VLD, I'm trying to compare to php files (echo1 and echo2)
echo1.php
<?php
echo "Hello"." "."World";
echo2.php
<?php
echo "Hello"," ","World";
phpinfo() shows that vld seems to be enabled:
vld support enabled
Directive Local Value Master Value
vld.active 0 0
vld.col_sep
vld.dump_paths 1 1
vld.execute 1 1
vld.format 0 0
vld.save_dir /tmp /tmp
vld.save_paths 0 0
vld.skip_append 0 0
vld.skip_prepend 0 0
vld.verbosity 1 1
problem
running php files shows output instead of opcode
# php -dvld.active=1 -f echo1.php
Hello World
# php -dvld.active=1 -dvld.execute=0 -f echo1.php
Hello World
# php -dvld.active=1 -f echo2.php
Hello World
# php -dvld.active=1 -dvld.execute=0 -f echo2.php
Hello World
Obviously I'm missing something :)
versions running
php version
# php -v
PHP 5.4.4-14+deb7u14 (cli) (built: Aug 21 2014 08:36:44)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Running Debian in Virtualbox with Apache 2.2.22
After updating to PHP 5.6.2 I gave it another go and it is running :)
php version
# php -v
PHP 5.6.2 (cli) (built: Oct 17 2014 07:22:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
install pear
yum install php56w-pear
installing vld
pecl install vld
add extension to /etc/php.ini (or in file in /etc/php.d/__.ini)
#/etc/php.d/vld.ini
extension=vld.so
restart httpd service and test again (fingers crossed)
# php -dvld.active=1 -f echo1.php
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /var/www/html/echo1.php
function name: (null)
number of ops: 4
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > CONCAT ~0 'Hello', '+'
1 CONCAT ~1 ~0, 'World'
2 ECHO ~1
3 3 > RETURN 1
branch: # 0; line: 2- 3; sop: 0; eop: 3; out1: -2
path #1: 0,
Hello World
Boom Baby!
I don't know why, but it is working as expected :)
Now the OPCODE adventures can begin (also a love story)
You might be add extension.so to wrong php.ini file
You might be add the extension to php.ini that use by your webserver instead of cli version
What you can do is run locate php.ini, and choose the cli version of php.ini and add extension.so to that file
Normally cli version of php.ini located at /etc/php5/cli/php.ini
Dont forget to restart your console too
THIS IS A REPOST, PREVIOUS POST GOT CLOSED, MOVED TO SERVERFAULT AND CLOSED AGAIN. I think this post is a valid stackoverflow problem because i think its caused by some automake/compile/linking error. This is a programming problem not a server admin problem.
Cross compile PHP
https://serverfault.com/questions/418521/cross-compile-php
Start of post
I have downloaded the PHP 5.4.0 source, extracted it and moved into the source folder.
I do a configure with:
./configure --build=x86_64-unknown-linux-gnu --host=arm-linux-uclibcgnueabi --prefix=/usr/arm/www CC="arm-linux-uclibcgnueabi-gcc --sysroot=/toolchains/gnu_cortex-a9_tools/" --disable-libxml --disable-dom --without-iconv --without-openssl --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --without-sqlite3 --disable-pdo --without-pdo-sqlite --disable-phar --with-config-file-path=/etc/
Followed by
make
no errors, everything runs fine.
Next i do a make install.
make install
Again everything runs fine.
i move it to the target platform and run
/usr/arm/www/bin/php -v
PHP 5.4.0 (cli) (built: Aug 15 2012 16:07:41)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
I test a simple home page with my webserver and directly with php.
<?php echo "hello" ?>
# php index.php
hello
it works as expected.
next i test:
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>
oh noes~
# php shell.php
Segmentation fault
I teset another script:
#!/bin/php
<?php
echo "hello";
$handle = fopen("info.txt", "r");
echo $handle;
?>
Same result:
# php index.php
helloSegmentation fault
do i have a php.ini?
# /usr/arm/www/bin/php --ini
Configuration File (php.ini) Path: /etc/
Loaded Configuration File: /etc/php.ini
yes, and no disabled functions.
testing strace /usr/arm/www/bin/php index.php
lstat("/srv/www/info.txt", {st_mode=S_IFREG|0644, st_size=20, ...}) = 0
open("/srv/www/info.txt", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20, ...}) = 0
lseek(3, 10, SEEK_CUR) = 0
--- SIGSEGV (Segmentation fault) # 0 (0) ---
+++ killed by SIGSEGV +++
the file info.txt exists and it got premission to read/write to it.
Testing strace /usr/arm/www/bin/php shell.php
fcntl64(3, F_GETFL) = 0 (flags O_RDONLY)
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7e31fddc) = -1 EINVAL (Invalid argument)
vfork() = 3324
close(4) = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "total 24\n-rw-rw-r-- 1 1001 "..., 8192) = 468
read(3, ""..., 8192) = 0
--- SIGCHLD (Child exited) # 0 (0) ---
close(3) = 0
wait4(3324, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3324
--- SIGSEGV (Segmentation fault) # 0 (0) ---
+++ killed by SIGSEGV +++
if i run the index.php through gdb it gives me:
Starting program: /usr/arm/www/bin/php index.php
hello
Program received signal SIGSEGV, Segmentation fault.
zend_do_fcall_common_helper_SPEC (execute_data=0x2ac7a040) at /home/maiden/Downloads/php-5.4.0/Zend/zend.h:391
391 /home/maiden/Downloads/php-5.4.0/Zend/zend.h: No such file or directory.
in /home/maiden/Downloads/php-5.4.0/Zend/zend.h
gdb gives me this from shell.php
Starting program: /usr/arm/www/bin/php shell.php
Program received signal SIGSEGV, Segmentation fault.
zend_do_fcall_common_helper_SPEC (execute_data=0x2ab76040) at /home/maiden/Downloads/php-5.4.0/Zend/zend.h:391
391 in /home/maiden/Downloads/php-5.4.0/Zend/zend.h
zend.h is located in /usr/arm/www/include/php/Zend/
obviously something went wrong during cross compilation. what have i missed? i do not find any configure flag to correct this and creating a symlink to the desired location removes the gdb output but php still segfaults.
Thanks for any help!
UPDATE:
# valgrind php test.php
==2181== Memcheck, a memory error detector
==2181== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2181== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==2181== Command: php test.php
==2181==
==2181== Conditional jump or move depends on uninitialised value(s)
==2181== at 0x4004EC8: ??? (in /lib/ld-uClibc-0.9.30-nptl.so)
==2181==
==2181== Invalid read of size 4
==2181== at 0x4004D48: _dl_get_ready_to_run (in /lib/ld-uClibc-0.9.30-nptl.so)
==2181== Address 0x7d4cc304 is just below the stack ptr. To suppress, use: --workaround-gcc296-bugs=yes
==2181==
==2181== Invalid read of size 4
==2181== at 0x48C348C: __uClibc_main (in /lib/libuClibc-0.9.30-nptl.so)
==2181== Address 0x7d4cc554 is just below the stack ptr. To suppress, use: --workaround-gcc296-bugs=yes
==2181==
==2181== Invalid write of size 4
==2181== at 0x233010: __eqdf2 (ieee754-df.S:1120)
==2181== Address 0x7d4cb0bc is just below the stack ptr. To suppress, use: --workaround-gcc296-bugs=yes
==2181==
Warning: shell_exec(): Unable to execute 'ls -lart' in /test.php on line 3
==2181== Invalid read of size 4
==2181== at 0x1FF1AC: zend_do_fcall_common_helper_SPEC (zend.h:391)
==2181== by 0x1F3D17: execute (zend_vm_execute.h:410)
==2181== by 0x18B217: zend_execute_scripts (zend.c:1279)
==2181== by 0x1365BB: php_execute_script (main.c:2473)
==2181== by 0x22B52B: do_cli (php_cli.c:988)
==2181== by 0x22BD4B: main (php_cli.c:1364)
==2181== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==2181==
Segmentation fault
Update2
re-run valgrind with memcheck, got about the same output as before but this was new:
php: can't resolve symbol '__libc_freeres'
Update3
While valgrind have failed me, i continued with gdb, i created the folder /home/maiden/..etc on my target system and copied over the content of my php/include folder and re-run gdb. now i get this error message:
(gdb) run index.php
Starting program: /bin/php index.php
hello
Program received signal SIGSEGV, Segmentation fault.
zend_do_fcall_common_helper_SPEC (execute_data=0x2ab34040) at /home/maiden/Downloads/php-5.4.5/Zend/zend.h:391
warning: Source file is more recent than executable.
391 return --pz->refcount__gc;
this is very similar to what sixeightzero wrote in the comments yesterday.
I have now tried PHP version 5.3.5, 5.4.0, 5.4.5 same error on all.
Update4
I downloaded a new toolchain for glibc, cross compiled a new busybox with glibc, created a chroot jail, cross compiled php with glibc instead of uclibc and tested it inside my chroot jail on my uclibc box, and it works! But i still need to get php to work in my uclibc environment....
i would check configure.log of uClibc to see if ARCH_USE_MMU and fork is enabled. if not vfork is replaced with fork which is likely to be used by shell_exec. the main problem with vfork is, parent and child uses same memory space which leads to weird crashes.