xenium
asked on
Newbie to Bluehost command line / scripting
hi,
I want to use imagemagick on the cloud, i have a Bluehost account that says it's available https://my.bluehost.com/hosting/help/imagemagick
I have very limited experience in unix (or whatever the operating system is?) and I'm unable even to find out how to get to a command line to test this.
This question is just to get me kicked in the right direction, so any of the following would be a good start:
1. getting onto a command line and verifying the statements form the link above
2. creating a simple script file that i can run on the server somehow
3. a dummies summary of how imagemagick could work on bluehost
Attached screenshot of some of the bluehost advanced options.
Thanks
Related question resolved:
https://www.experts-exchange.com/questions/29103444/Using-a-google-script-to-process-a-jpeg-image.html
I want to use imagemagick on the cloud, i have a Bluehost account that says it's available https://my.bluehost.com/hosting/help/imagemagick
I have very limited experience in unix (or whatever the operating system is?) and I'm unable even to find out how to get to a command line to test this.
This question is just to get me kicked in the right direction, so any of the following would be a good start:
1. getting onto a command line and verifying the statements form the link above
2. creating a simple script file that i can run on the server somehow
3. a dummies summary of how imagemagick could work on bluehost
Attached screenshot of some of the bluehost advanced options.
Thanks
Related question resolved:
https://www.experts-exchange.com/questions/29103444/Using-a-google-script-to-process-a-jpeg-image.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Related question resolvedSpeaking of that related question, would you please kindly answer my last question there, i.e., which of the numerous ideas in that thread wound up being the solution for you? Thanks, Joe
ASKER
hi Joe, i don't have an implemented solution yet but I will be sure to update the respective ee questions if/when this happens. It won't be quick though as there isn't really any budget on this.
i don't have an implemented solution yetThen why did you pick only one post as a solution when there were several others, some of which took quite a while to write and were clearly helpful, including 55 lines of program code that work and were thoroughly tested, as shown by several screenshots with proven results? It's a good idea to be fair to the folks here at EE who help you. Regards, Joe
ASKER
hi Joe, i have posted a response directly on the question in question!
OK, I'll check it out there.
ASKER
I'm having trouble getting any php to run.
Here is a test file: http://enex.net/ee/helloworld_php.html
I thought the .htaccess file needed updating based on this: https://my.bluehost.com/hosting/help/143
which i tried with no luck, then noticed that the file already had the following:
#AddHandler application/x-httpd-php56 .php
So i removed the # which i guess is the comment symbol, and commented out the first change.
Still no luck. Am i miles off? If i can get a helloworld script to run on bluehost i'll count that as success here!
Thanks a lot
Here is a test file: http://enex.net/ee/helloworld_php.html
I thought the .htaccess file needed updating based on this: https://my.bluehost.com/hosting/help/143
which i tried with no luck, then noticed that the file already had the following:
#AddHandler application/x-httpd-php56 .php
So i removed the # which i guess is the comment symbol, and commented out the first change.
Still no luck. Am i miles off? If i can get a helloworld script to run on bluehost i'll count that as success here!
Thanks a lot
ASKER
...i'm checking https://my.bluehost.com/hosting/help/281
ASKER
1. You have to change the file extension to .php, not .html, in order for it to be processed as a PHP file. So just rename helloworld_php.html to helloworld_php.php and then try it again.
2. phpMyAdmin is an administrative tool for MySQL.
3. The amount of traffic does look unusually high for an average site. You might want to check your web server access logs, and also the "Processes" button within phpMyAdmin.
That said, there's a chance that you're looking at the overall server statistics rather than just YOUR statistics. With shared hosting, you're sharing a single MySQL server with several other people, but everyone can only manage their own databases.
2. phpMyAdmin is an administrative tool for MySQL.
3. The amount of traffic does look unusually high for an average site. You might want to check your web server access logs, and also the "Processes" button within phpMyAdmin.
That said, there's a chance that you're looking at the overall server statistics rather than just YOUR statistics. With shared hosting, you're sharing a single MySQL server with several other people, but everyone can only manage their own databases.
ASKER
I had tried .php extension with no luck. It just downloads the file:
http://www.enex.net/ee/helloworld.php
http://www.enex.net/ee/helloworld2.php
In any case php embedding into .html should work too.
http://www.enex.net/ee/helloworld.php
http://www.enex.net/ee/helloworld2.php
In any case php embedding into .html should work too.
So I would expect the AddHandler line to be the required change here. The typical behavior for Apache / PHP integration is that a line like this:
AddHandler application/x-httpd-php56 .php
...will say "Any file that ends with .php should be considered a 'application/x-httpd-php56 ' type of file, and should be handled by whatever application processes that kind of file."
Then there is usually a line in the main server configuration that loads up the PHP module so that it defines "application/x-httpd-php56 " as something that is processed by the PHP engine.
If you look at that BlueHost FAQ page that you linked to, the example is:
AddHandler application/x-httpd-php5 .html .php .htm
...which says, "Any file that ends with .html, .php, or .htm should be considered a 'application/x-httpd-php5' type of file...etc...."
I also noticed that the FAQ page indicates that it is deprecated. When I search their FAQs for PHP, I found this page:
https://my.bluehost.com/hosting/help/htaccess-php-handlers
I noticed they don't have an entry for "application/x-httpd-php56 ", which is why the file is being downloaded instead of processed.
So I would recommend taking out your other AddHandler line (the one with php56" and replacing it with:
AddHandler application/x-httpd-php70 .php
And then re-testing.
I'd also suggest you DON'T set up .html and .htm files to be processed by the PHP engine. If you want, I can go into the specific reasons why but it's generally a bad practice and has more problems than benefits.
AddHandler application/x-httpd-php56 .php
...will say "Any file that ends with .php should be considered a 'application/x-httpd-php56
Then there is usually a line in the main server configuration that loads up the PHP module so that it defines "application/x-httpd-php56
If you look at that BlueHost FAQ page that you linked to, the example is:
AddHandler application/x-httpd-php5 .html .php .htm
...which says, "Any file that ends with .html, .php, or .htm should be considered a 'application/x-httpd-php5'
I also noticed that the FAQ page indicates that it is deprecated. When I search their FAQs for PHP, I found this page:
https://my.bluehost.com/hosting/help/htaccess-php-handlers
I noticed they don't have an entry for "application/x-httpd-php56
So I would recommend taking out your other AddHandler line (the one with php56" and replacing it with:
AddHandler application/x-httpd-php70 .php
And then re-testing.
I'd also suggest you DON'T set up .html and .htm files to be processed by the PHP engine. If you want, I can go into the specific reasons why but it's generally a bad practice and has more problems than benefits.
ASKER
Thanks for the suggestion, I tried that again no luck though. Here is the .htaccess file in case something else pops up:
.htaccess ( UTF-8 Unicode English text )
RewriteOptions inherit
RewriteEngine on
# Use PHP5.6 as default
# AddHandler application/x-httpd-php56 .php
# AddHandler application/x-httpd-php5 .html .php .htm
AddHandler application/x-httpd-php70 .php
RewriteCond %{HTTP_HOST} ^enex\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.enex\.net$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteRule ^/?$ "http\:\/\/www\.autoreconuk\.com\/" [R=302,L]
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^21SMP$ "https\:\/\/www\.airbnb\.co\.uk\/rooms\/814055\?check_in\=2050\-01\-01\&check_out\=2050\-01\-02" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^flat1$ "https\:\/\/www\.airbnb\.co\.uk\/rooms\/2921188\?check_in\=2050\-01\-01\&check_out\=2050\-01\-02" [R=302,L]
Options +Indexes
IndexOptions -FancyIndexing
Interesting. There's an AddType in there that seems like it's referencing the old type, but it says it's generated by cPanel. I would comment that out (the "AddType" line) just as a test to see if that addresses the issue. If so, there might be a setting in cPanel that you have to change to get it to work right. Just make a backup copy first.
ASKER
Thanks for the suggestion, though it didn't work.
On the cpanel there is a MultiPHPmanager that allows changing the PHP version per domain, i have changed this to ea-php70 for now (it was ea-php56) so it matched the .htaccess file
This has no visible effect though.
On the cpanel there is a MultiPHPmanager that allows changing the PHP version per domain, i have changed this to ea-php70 for now (it was ea-php56) so it matched the .htaccess file
This has no visible effect though.
ASKER
ASKER
THere are ton of other cpanel options, see start of this question. There is also an error log which is blank.
At this point:
1. I'd try renaming the .htaccess to something else, like old_htaccess.
2. Go into the CPanel and click on PHP Config.
3. Select the latest PHP option that doesn't have anything in parentheses next to it, e.g. PHP 7.0.
4. Retry the PHP file.
If that still doesn't work, I'd suggest contacting BlueHost support for help.
1. I'd try renaming the .htaccess to something else, like old_htaccess.
2. Go into the CPanel and click on PHP Config.
3. Select the latest PHP option that doesn't have anything in parentheses next to it, e.g. PHP 7.0.
4. Retry the PHP file.
If that still doesn't work, I'd suggest contacting BlueHost support for help.
ASKER
Thanks again for the tips. There's no "PHP Config" option.
I'll contact Bluehost support and report back.
I'll contact Bluehost support and report back.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Right - and just so you're aware - that configuration does NOT enable PHP for files ending in .html. So if you look at the second link, you'll see your unprocessed, raw PHP source code. But that's a good thing - only files ending in .php, .php7, or .phtml should be processed with PHP.
ASKER
For the html page i'm seeing "My first PHP page" and no code.
I'm mobile at the moment but when i checked on my laptop the php was hidden i could only see the html when inspecting. This is as i would expect.
Are you seeing something different? Maybe refresh to check as file was updated.
I'm mobile at the moment but when i checked on my laptop the php was hidden i could only see the html when inspecting. This is as i would expect.
Are you seeing something different? Maybe refresh to check as file was updated.
You have to view the source of the HTML page to see the PHP source code. That's because the "<" character at the beginning of "<?php" makes web browsers think you're trying to render some kind of HTML tag, but it doesn't know what kind of tag "?php" is, so it just doesn't show anything. However, the point is that the PHP code did not actually execute within the page that ends in .html. Again, this is the correct behavior. You only want PHP code to be executed when the file ends in .php, .php7, or .phtml (according to that configuration in your .htaccess file).
ASKER
Ah ok thanks for the clarification. I got confused with all the test files, i see now the html did not run.
ASKER