views:

54

answers:

3

Hello,

I am very new to php, and I am trying to develop a facebook application using php. I am using Joyent as my hosting platform.

Currently, I am trying to do some simple scripts in php and then build on them. However I am unable to see any php files being rendered properly in my application.

For eg: I have a simple script called phpinfo.php:

If I execute this on terminal like php phpinfo.php , I can see all the configurations. However if I try to access the same file as http://xxxxxx.facebook.joyent.us/phpinfo.php, I get : Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

Even if I rename this file to index.php its still the same. However I am able to access other html files [index.html] on the same location .

These are some of my php settings: These are some of the settings:

[fbkusoni:~/web/public] aafhe7vh$ php phpinfo.php | grep On
allow_url_fopen => On => On
auto_globals_jit => On => On
enable_dl => On => On
file_uploads => On => On
ignore_repeated_errors => On => On
ignore_repeated_source => On => On
implicit_flush => On => On
log_errors => On => On
register_argc_argv => On => On
report_memleaks => On => On
y2k_compliance => On => On
Multibyte regex (oniguruma) backtrack check => On
mysql.allow_persistent => On => On
session.bug_compat_warn => On => On
session.use_cookies => On => On
suhosin.cookie.cryptdocroot => On => On
suhosin.cookie.cryptua => On => On
suhosin.mt_srand.ignore => On => On
suhosin.protectkey => On => On
suhosin.server.encode => On => On
suhosin.server.strip => On => On
suhosin.session.cryptdocroot => On => On
suhosin.session.cryptua => On => On
suhosin.session.encrypt => On => On
suhosin.srand.ignore => On => On
suhosin.stealth => On => On

The answer might be very naive, but I am just trying to get started and looking for any suggestions regarding this and also using Joyent and cakephp to develop facebook applications.

Thanks.

A: 

PHP may not be installed as an Apache module correctly. You can run it on the command line because that's in CGI mode & doesn't need Apache. Run apachectl configtest to see if there's anything wrong with the Apache configuration.

Pickle
Hi Pickle, Thnks 4 reply. I executed the command:> apachectl configtesthttpd: Syntax error on line 2 of /opt/local/etc/httpd/httpd.conf: Could not open configurationThe file looks likecat /opt/local/etc/httpd/httpd.conf# There are things to set in core.confInclude /opt/local/etc/httpd/includes/core.conf# There is no reason to touch pid.confInclude /opt/local/etc/httpd/includes/pid.confOn Joyent servers I do nt have access 2 /opt/local/etc/httpd/httpd.conf ; I ll try 2 figure out a way 2 edit the files if thats the prblm. Also is there a way 2 post larger comment on this forum?
p1
A: 

Is your script executable (chmod +x phpinfo.php)?

What does the web server error log say?

Pete
Hi, Thanks for the replyYes the script is executable. I am trying to search for error logs on the virtual console on the servers :), Any specific place I should look for logs if someone has used Joyent before.http://www.joyent.com/
p1
Somwehere like /var/log/apache2/error.log
Pete
Hi Pete, I was able to see the logs , I change the error_log parameter to write it to a file. These are the errors:PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0PHP Fatal error: Unable to start eAccelerator module in Unknown on line 0PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0I am trying to look if this is Joyent specific issue. Do you know which file is it referring to when it says line 0?
p1
I found out that this is related to shared memory size being too small by default. eaccelerator.net/wiki/Faq Interestingly I dont have this file /etc/sysctl.conf Should I be looking at any other location or just create one there ?
p1
It turns out that eAccelerator won't work properly at all on Joyent's stack. They use FastCGI based PHP managed by mod_fcgid, and that's not a situation that any PHP cache can provide any benefit in.For the benefit of anyone hitting the same problem, just remove eaccelerator.so from your php.ini file completely
p1
A: 

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

This may indicate a syntax error in your code. Try doing a php -l <filename> from the command line for each of your scipt files to verify that they don't contain any syntax errors

Mark Baker
Thanks for the reply, I confirmed there are no errors. Infact since I am able to execute it on terminal might indicate that syntactically it is correct.
p1