No php.ini file - web

I'm making a PHP form that requests a file for download. I've had an error with the script and did some searching found out that it was because my php.ini file needed allow_url_fopen = On, so I went to change the settings and my site has no php.ini file. I couldn't really find out how to make a php.ini file. How would I create this file? My web host says I need to create it. What are the default settings to put into this file?

First, try to figure out, whether you really don't have the file. The php.ini location can be found in phpinfo(); output.
Second, if there is such file, edit that one. If not, download the ZIP package from php.net and there is at least php.ini.recommended, which contains basic directives.

Well, if you have no php.ini file, you can create it with as few lines in it as you need. Just put allow_url_fopen = On on an ascii file and name it php.ini, copy it to the working directory or the public root. Take in mind that anyway this values can be overrided by hosting's staff in places where you do not have access. To see what is the final and actual setting that aplies use phpinfo().
A side note: .htaccess files can in some circunstances govern and override php settings, so also take a look on all of them (that are accesible to you) to see if you can set your preferences there. Be careful that systax differs from php.ini .htaccess example

Related

I can't find htaccess in typo3

I am using Typo3 4.5., and am running into the problem which appears to be solved here: TYPO3 breaks urls without WWW ... (website redirects to index without WWW)
The answer recommended there involves editing the htaccess file.
My problem is I cannot find this file anywhere. I am not experienced with Typo3, how can I safely edit this document?
I have gone into my filelist and found an htaccess file at [fileadmin/]: temp/ but I cannot edit this document. Clicking on it gives me an error 403 in a new window. In german nonetheless.
Even the question is related to a very old TYPO3 version I want to answer here for the current version 9.5 where several .htaccess files are saved in the folder
typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/
These are the files in that folder:
fileadmin-temp-htaccess
fileadmin-temp-index.html
fileadmin-user_upload-temp-importexport-htaccess
root-htaccess
root-web-config
typo3temp-var-htaccess
All files with htaccess at the end (above bold text) should be used according to the filename, copied in the corresponding directory and each copy then renamed to .htaccess.
The other files should be used too according to name and content.
It has to be considered that .htaccess-files perhaps are not exchangeable always between TYPO3 versions; I never had problems with it during many updates but it should always be checked.
The .htaccess file is a hidden file and is located in the document root of your website. This file can't be edited from inside of TYPO3, you need direct access to the webserver (ssh, sftp, ...)
If you installed TYPO3 from the "dummy package", it should have a "_.htaccess" file in the root that must be renamed. As the previous answer by #M Klein told you, you must rename or edit it by direct access to your server.
Another possibility is that the file has been accidentally removed; in this case you could download the "dummy package" (select your TYPO3 version) and pick a new one from there.

.htaccess doesn't work if comment row (# ...) exist

code below doesn't work my .htaccess file. I mean, after this code is applied, I can still index folders in html.
# BEGIN disable folder index
Options All -Indexes
# END disable folder index
however, code below works. I mean, after this code is applied, server gives 403 if I try to index a folder which I know that it exists.
Options All -Indexes
I'm on a shared hosting and have nothing to do with server config. .htaccess is created via notepad++ with encoding setting UTF-8 without BOM. .htaccess permission is set to 0644. there exist no other code in .htaccess.
what does this situation mean? what am I doing wrong?
Ok, looks like my original comment above pushed you into the right direction:
Most likely this is a problem with the line breaks. So that for the
interpreting part of the http server that "Options" line is not on a
separate line, thus also commented out. Check your line ending
characters by using a hexeditor. That s the only reliable tool to do
so.

Which is the best way to make config changes in conf files in ansible

Initially I used a makefile to deploy my application in linux.
I had various sed commands to replace variables like the PHP upload file size, post size, log file location etc.
Now I am shifting to ansible. I know I can copy the files, but how can I make changes to the conf files? Like if i just want to change the upload_filesize = 50M parameter. I don't want to make copies of the whole conf file and then replace with my file.
Sometimes it’s only a one-line change. Is there any better way to edit the config files in ansible?
If it's an INI file, then your specific requirements can be probably met by ini_file module (http://docs.ansible.com/ini_file_module.html).
If your change is limited just few lines (or eve one), then you can probably look at lineinfile module (http://docs.ansible.com/lineinfile_module.html).
Should you however need to change large number of settings, then it may be more beneficial to use template (http://docs.ansible.com/template_module.html) or assemble (http://docs.ansible.com/assemble_module.html). The main disadvantage of this approach is that you may need to review your template or fragments when updating your dependency.
Depending on the operating system, you can add files here /etc/php/apache2/conf.d/10-someinifilewithsetting.ini

when apply "chattr +a" on a folder, vim automatically generate numbered file

I have a folder called Text/, and I applied "chattr +a" on that folder as root to prevent deleting files, while allowing creation of new files inside the folder.
I created a new file inside this folder, but every time I changed the content of the file, it automatically generate a numbered file in the same directory, like 5036, 5159
should anyone know what's up? I tried to change the backupdir and dir(for swap file) in vimrc, but still not work.
If you have any idea on this issue, please help me, thanks!
By default Vim makes a backup before overwriting a file, which is deleted after the file is successfully written. As you mentioned on the comments, chattr +a prevents the removal of those bakcup files.
The generation of backup files can be disabled with :set nowritebackup for all files; backupskip option can be used to disable the backup only for folders with restrict attributes. Additional information on :h backup-table.

.htaccess in Notepad ++

I am working with Notepad and the FTP plugin. The .htaccess files do not show up in the folder tree of the server. Anyone else encountered this and know of a fix?
I know this is an old question now, but I've run into this problem, too.
In the current version of Notepad++ (v5.9) the NppFTP plug-in (v0.23) has a setting for each connection called "LIST parameters". It is accessible via Settings/Profile settings/FTP Misc. Enter "-al" there and hidden files should be visible. Remember to set it for each profile.
The file is there, its just hidden. If you can type in a file name for download you can probably get it.
I don't use notepad plus but if the ftp plugin has a setting to show hidden files then you should be able to change that so you can see the .htaccess file. The server is probably unix so any file that starts with a dot is a hidden file.
It's normal behaviour. In options of your FTP client plugin find option "show hidden and hidden files. For example in Total Commander it's:
Network -> FTP Show hidden files
In the FTP page profile settings, choose FTP misc. and type -al. It fixed my problem

Resources