PHP execution?

myildi37

New Member
Prime Account
Messages
14
Reaction score
0
Points
0
Hello,

I am a new x10 free user. I am migrating an existing web site on this host but I have a problem with my php scripts.
Even if I try open a very simple test.php file in Firefox, I get an error (see below):

test.php contains:
<?php
Print "<HTML><head>";
Print "<TITLE>Telechargement</TITLE></head> <body bgcolor='#CC3333' text='#FFFFFF'>";
Print "<hr><br><H2>Test PHP</H2><br><hr> <p>";
Print "</head></HTML>";
?>

and I get
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, no-reply@x10hosting.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


How can I get PhP on the server?


Thank you very much in advance for your help.


Murat
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Make sure the file permissions are set to 0644. Something like 0666 or 0777 will cause that error.

Also, print is not capitalized in PHP.
 

myildi37

New Member
Prime Account
Messages
14
Reaction score
0
Points
0
Thank you very much for your quick reaction! I am completely at lost with this problem.
My file has 644 as rights, no problem and I have changed prints in the file (I have always thought that both was working in PHP, by the way I have code using Print and working on the server from which I am migrating.
So, there must be another problem here.

Does a new user automatically get the rights to use PhP on this host? I have not seen any option about PhP on the management console.

I do not know anymore where to search...

Very cordially,

Murat
 
Last edited:

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
Do a new user automatically gets rights to use PhP on this host? I have not seen any option about PhP on the management console.
There should be nothing you need to do for PHP to work, so either the whole server is having an issue or something is up wit your account. Have you got any .htaccess files? If so, try renaming them all briefly and see if the issue persists.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Also, try creating the scripts in the File Manager. Uploading them sometimes leaves invisible characters that the PHP interpreter chokes on.
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
What server are you on ????

Which folder are you putting the script in ????

I use a LOT of PHP scripts both the old way and PDO on x10Hosting

Here is my simple test PHP script

PHP:
<?php
print "Hello World";
?>

I just uploaded via FileZilla, Murat's script to server boru in folder /public_html
runs with red background like it should
 
Last edited:

myildi37

New Member
Prime Account
Messages
14
Reaction score
0
Points
0
Thank you very much for your suggestions!

https://x10hosting.com/control/?hosting
tells me that I am on chopin.

The path to my script is public_html/livretj/ (with 777 authorizations, put by default by CyberDuck, or the host. Can this be a source of problem?).

My script can be tested at the following address:
http://yildizoglu.x10.mx/livretj/test.php

I do not have any .htaccess file in this folder.

I do not seem to have any strange element in my configuration, do I?

Mainly, I have created my account. Then an ftp account and copied all my working website on x10host's public_html folder under my account. HTML pages work, I have small problems with my DHTML menu system created by Sothink's DHTML Menu (some icons missing even if they are in the corresponding folder), and this global problem with my PhP scripts (nothing very fancy, some simple MySQL based forms). All my system was living and functioning on my preceding server without any problem (a Debian server).

In the beginning, I have thought that I was misconfiguring access to my MySQL database, but checking that even this simple script is not working, I suspect a PhP problem somewhere.

The problem is that I am lost at this stage have no idea where this can be.

Murat
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
(with 777 authorizations, put by default by CyberDuck, or the host. Can this be a source of problem?).
There's your problem, change the file permissions to 0644 and the containing folder to 0755 or lower as required. Any file permissions 0777 will be blocked by the server and is what is causing your 500 errors.
 

myildi37

New Member
Prime Account
Messages
14
Reaction score
0
Points
0
I have used the file manager in cPanel to change the permissions (for an unknown reason, I cannot do it using Cyberduck - my FTP client)).

The folders need at least 775 to be accessible by the web server as far as I ca see. If I give them 664, I cannot access to any file, including the HTML files that were accessible before. If I change to 775, the latter become accessible.

Now, my folders have 775 and my files 664.

My PhP test file gives a 500 error, even if I put it's authorization to 664. I cannot run any php file on my account, which is normal since even this stupid test.php does not work.

So there must be a problem at another level :-(

Any other idea? Am I the only new meeting this problem (on chopin)?

Do you know if the support people follow these forums? I have sent a support request but have not received any reply.

Murat
 

myildi37

New Member
Prime Account
Messages
14
Reaction score
0
Points
0
Re: PHP execution? [Solved]

I have solved the problem using two sources of information (see below).

To summarize: your folders must have rights 755 and your php files 644 (not 664).

The support has indicated me the 755 part and installing Moodle using Fantastico, I have seen that it gave 644 rights to the php scripts. Given these rights to my folders and php file have solved the problem.

It seems that I will now be able to explore this magnificent host!

Thanks to all!

Murat
 

mandy0

New Member
Messages
32
Reaction score
0
Points
0
Re: PHP execution? [Solved]

dude just try it
Code:
<?php
echo "Hi";
?>
echo better if you don't want to use print.
 
Top