Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Couple of php issues - any suggestions?
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Couple of php issues - any suggestions?
Couple of php issues - any suggestions?
09-11-2013 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
1: I want .htm or .html files to execute as php scripts. There are normally a couple of ways of doing this in .htaccess but none seem to work on pn ccgi space.
Typically:
2: If I have an auto_prepend_file = "path/file.php" command in php.ini, the server reports that it cannot find the file to prepend, even though it then proceeds to report the correct location of the file. However, if I include the same file using a standard php include command with exactly the same path, that works. I've tried a relative path, path from webspace root, path from filesystem root, but none work. Any idea what path information the server is looking for?
UPDATE: OK, found answer to #2, pn servers don't like quotes around the filename. Still looking for solution to #1 though.
Typically:
AddHandler php-script .htmbut none seem to work.
Or
<FilesMatch "\.(htm|html|php)$">
SetHandler application/x-httpd-php
</FilesMatch>
Or
<Files "*.htm">
SetHandler application/x-httpd-php
</Files>
2: If I have an auto_prepend_file = "path/file.php" command in php.ini, the server reports that it cannot find the file to prepend, even though it then proceeds to report the correct location of the file. However, if I include the same file using a standard php include command with exactly the same path, that works. I've tried a relative path, path from webspace root, path from filesystem root, but none work. Any idea what path information the server is looking for?
UPDATE: OK, found answer to #2, pn servers don't like quotes around the filename. Still looking for solution to #1 though.
Message 1 of 6
(1,144 Views)
5 REPLIES 5
Re: Couple of php issues - any suggestions?
09-11-2013 9:49 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
AddHandler cgi-script .htm
will get your .htm files handled as scripts, but I think binfmt for php will only know about the .php extension, so you would need to add shebang lines to use /usr/bin/php5-cgi
Or you could use a rewrite. Something like:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.htm$ $1.php
Gabe
Message 2 of 6
(346 Views)
Re: Couple of php issues - any suggestions?
10-11-2013 3:02 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Unfortunately, AddHandler cgi-script .htm causes a 500 error, even if it is the only command in .htaccess.
Meanwhile rewriting would not achieve the desired result since all of the files would have to be renamed. The objective is to have scripting enabled in standard files.
Thx for reply anyway.
Meanwhile rewriting would not achieve the desired result since all of the files would have to be renamed. The objective is to have scripting enabled in standard files.
Thx for reply anyway.
Message 3 of 6
(346 Views)
Re: Couple of php issues - any suggestions?
10-11-2013 3:32 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: Anteaus AddHandler cgi-script .htm causes a 500 error
Presumably you didn't add a shebang line.
Quote all of the files would have to be renamed
That's easily scripted, though the !-f allows a mix. Those are the only options I can think of with the ccgi set-up.
Gabe
Message 4 of 6
(346 Views)
Re: Couple of php issues - any suggestions?
10-11-2013 6:18 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote Presumably you didn't add a shebang line.
If that has to be done to every page, then it's going to cause major issues, especially for any new pages built with software. Probably easier toaccept the workload of bulk renaming and bulk link-replacement than having a situation where no new page will work until doctored.
Message 5 of 6
(346 Views)
Re: Couple of php issues - any suggestions?
11-11-2013 4:04 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Or you could use a wrapper script.
Gabe
Gabe
Message 6 of 6
(346 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Couple of php issues - any suggestions?