473,372 Members | 995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Shared object and php - 'cannot restore segment prot after reloc: Permission denied'

Dheeraj Joshi
1,123 Expert 1GB
i have a shared object (.so) as example.so

In my php file when i try to call a function myfun() which is in example.so

I get a name look up error.. I gave the extensions properly in php.ini..

my code is
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("example.php")
  3.  
  4. $num=example::myfun();
  5.  
  6. echo "$num;
  7.  
Aug 7 '09 #1
16 4573
Dheeraj Joshi
1,123 Expert 1GB
Look up error is gone.. Its fine now. But a new error.

Warning: dl(): Unable to load dynamic library './example.so' - ./example.so: cannot restore segment prot after reloc: Permission denied in /root/example.php on line 22

Fatal error: Call to undefined functionmyfun() in /root/myfile.php on line 4

I place these .so files in /root

and in php.ini i gave extension as /root/example.so.

We can place .so anywhere and give extension in php.ini file right?

Or should we place in specific locations?
Aug 7 '09 #2
Dormilich
8,658 Expert Mod 8TB
it looks like you don't have access to root's home directory (which would make sense). place the file somewhere with public access (like php's directory (something like /usr/bin or /var or /opt ...) otherwise you have to modify permission rights.
Aug 7 '09 #3
Dheeraj Joshi
1,123 Expert 1GB
Right now i am logged in as root.

And your meaning of permission means?

Regards
Dheeraj Joshi
Aug 7 '09 #4
Dormilich
8,658 Expert Mod 8TB
@dheerajjoshim
isn't that risky?

well, I guess it's PHP (resp. its process) that needs access permission then. (therefore I recommended PHP's directory)

@dheerajjoshim
file system permission
Aug 7 '09 #5
Dheeraj Joshi
1,123 Expert 1GB
Hey Dormilich i got the root cause of the problem.

My security policy was not allowing me to create a shared library.

When i disabled it, It is working.
Aug 7 '09 #6
Dormilich
8,658 Expert Mod 8TB
if you use __autoload() then you may indeed don't need it, though.
Aug 7 '09 #7
Dheeraj Joshi
1,123 Expert 1GB
I am trying to call a C function via PHP. So will __autoload( ) does that?

I think it won't work for 2 different languages.? Or will it work?
Aug 7 '09 #8
Dormilich
8,658 Expert Mod 8TB
@dheerajjoshim
wouldn't that usually work via shell command?
Aug 7 '09 #9
Dheeraj Joshi
1,123 Expert 1GB
It work's. But it was according to some specifications.So we had to take that route.

By the way, i observer strange thing. I am able to create .so file and call it in PYTHON.

Problem is coming only in PHP. Why?
Aug 7 '09 #10
Dormilich
8,658 Expert Mod 8TB
@dheerajjoshim
beats me, I've no idea.
Aug 7 '09 #11
Dheeraj Joshi
1,123 Expert 1GB
Even I don't have an idea. I am searching Internet, to get a answer. But it is strange behavior.
Aug 7 '09 #12
Markus
6,050 Expert 4TB
Get an answer for what? You just said it was working.
Aug 7 '09 #13
Markus
6,050 Expert 4TB
For any others experiencing this problem, this seems to be a common problem/fix.
Aug 7 '09 #14
Dheeraj Joshi
1,123 Expert 1GB
I am able to create a shared object and call the functions in PYTHON. But when i try to do it via PHP, I need to disable security policies of LINUX.

Why it works for one language and not for other.?
Aug 7 '09 #15
Dormilich
8,658 Expert Mod 8TB
maybe the processes' groups have different rights?
Aug 7 '09 #16
Dheeraj Joshi
1,123 Expert 1GB
May be....

But it is an interesting issue. Need to know more about it.
Aug 7 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jim | last post by:
Hello, I have a broken server that we are going to be moving off to a new server with a new version of DB2 but here is what I have right now: RedHat 7.0 (2.2.24smp) DB2 v6.1.0.40 I am...
7
by: Ken | last post by:
Hi guys, this is a curios thing, everything was working fine then I had to restore my development machine( VS.NET, SQL server etc) now I'm receiveing this error from my asp aplication only in...
1
by: Alexander Cohen | last post by:
Hi, sometimes ill get this error: FATAL: could not create shared memory segment: Cannot allocate memory DETAIL: Failed system call was shmget(key=2, size=4153344, 03600). HINT: This error...
3
by: gmax2006 | last post by:
Hi, I am using RedHat Linux 4. and I developed an oracle 10g based application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and Python 2.3.4. When I run the application through...
1
by: Simon Harvey | last post by:
Hi everyone, If anyone can help me with the following - I would be VERY grateful. I need to deploy an 2 ASP.net applications that I've been creating onto one of our live servers. Both...
1
by: Jerome | last post by:
Hi everybody, I need to remove access to a shared directory before to execute a process on the directory. And put back the access on it after the execution. So I wanted to set the permission...
21
by: llothar | last post by:
Hello, i need to manage a heap in shared memory. Does anybody know about a portable (win32+mac+posix) c implementation for this.
3
by: Okonita | last post by:
Hi all, I am having problem completing this restore operation. "db2 restore database AAMI01 from /pap/data/backups taken at 20071002130554 to /pap/data/db01 into AAMI01 NEWLOGPATH /pap/data/new/...
2
by: =?Utf-8?B?QW5kcmVhIEdhbGxhenpp?= | last post by:
Hello, I have a website on a NAS. Permissions are set correctly because I can open HTML files. When framework is involved i receive this exception: System.Security.Policy.PolicyException:...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.