472,334 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 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 4500
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:...
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...
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...
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...
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.