Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I've recently upgraded to a dedicated server; previously I was on a shared server, so I have no experience with the php.ini file. I've opened it and looked through it, searched Google and SO but nothing is clear to me.
Can someone clear up, for me, the way to add/edit lines in an ini file and what, if any, lines can be removed?
More specifically I'd like to edit the time a session is active for, the default date, etc.
UPDATE: I'm running PHP 5.5 on a Linux server.
EDIT: There is some confusion: I'm not asking "how to edit the file". I'm asking "what parts of the file can I remove and where can I update parts of the file".
Ini format is rather simple: entries are key/value pairs, with an equal sign between each side. Comment lines start with a semicolon.
The php.ini is fairly well commented. I'd suggest commenting any lines out, rather than removing them, and restarting the webserver or running a command line app to see that startup goes okay.
Which lines are needed and which values are okay vary depending on your server config and the php programs you intend to run.
The default timezone setting is http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
There are a few session related config parameters. I suggest reading How do I expire a PHP session after 30 minutes? for info on session lifetime.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've got a problem. After moving a project to another server I get strange string "192" which is inserted before every response from server. I did no changes into source code and it works fine on another server. I've only copied project... Really. That's all.
This is how it looks:
It can be beared when dealing with generated pages. but json reponse is not correct so it gets broken because of this number "192".
In the root folder /var/www/html I have only this project. Nothing else.
I guess it must be something with php settings. Thanks in advance!
The problem is with the code off course. Check the configuration files you are adding before executing any file of the view.
If you want to verify there is something wrong with the code, you may just put an empty hello world file and execute it from the browser. See if 192 comes there also or not.
Something like this on /var/www/html/test.php
<?php echo "Hello World"; ?>
Now run your website http://yourwebsite.com/test.php and share the output.
If the 192 is not in your code (and since it doesn't show on a different server, it certainly seems so), another very strong contender from where it is coming from is the php.ini option, auto_prepend_file.
auto_prepend_file string
Specifies the name of a file that is automatically parsed before the
main file. The file is included as if it was called with the require
function, so include_path is used.
The easiest way to find out if there is a file being included before all of your requested pages is by searching the phpinfo() output for auto_prepend_file, and editing the php.ini file to remove it if it is there.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am accessing my remote server directory(/var/www) using the tool WINSCP. When I need to update a PHP file on the remote server, I work on a copy on my laptop (Windows 7), then I upload that copy to the corresponding directory at the remote server (by clicking right click on the file on the laptop directory, then I chose upload from the menu, then from the prompt I chose move and replace).
My question, during the transfer process, assume there is a user is using the system and he made a process was not done yet (let us say a process in mysql was working) and suddenly the PHP file is replaced with another one during the process. Will this make problem for my application? Is it healthy? Will it stop or a corruption will happen to database?
Shall I kick out all users before replacing PHP files at remote server? (that would be so hard option).
PHP read the whole script before running it, so replacing the file will have no effect on this, you can keep doing it like that.
If you have multiple PHP files and you are changing the API between them (add parameters to functions in your lib, for instance), you could run into trouble.
Same is if you use a database and you have to update your table definition.
As long as only a single PHP file changes, you are completely safe.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I used this tutorial to set up PHP on my server, but now my question is about MySQL. There are a lot of tutorials for unix like systems but for windows I can't find one which would work for me.
I took a look at this one, but it seems to be out of date, cause I can't find some files (my-medium.ini, my.ini) in mysql-5.6.15 folder.
I'll try an answer, easier to format ;)
You need to realize that there is no link between Nginx and MySQL. Nginx doesn't need to know that MySQL exists and the opposite is true.
And there is a small link with Php and MySQL, but in fact, it doesn't matter if the database is on your computer or another server. Php will just take the URL of the database to connect to it. If it's on your computer or somewhere else, it will work. You could even connect to multiple different databases on different computers.
All this to say that all you need to do (related to the MySQL installation) is to install MySQL on your Windows 7 machine. If the installation worked (normally, only executing an EXE file and pressing next, next, next), you'll be able to connect to it with php. Just note the PORT where MySQL will listen (it should be displayed in the wizard installation) and also remember the username password that you'll set for connecting to your MySQL server (it should be asked throughout the installation wizard).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
This question is directly related to a previous question of mine :
php files are downloaded instead of ran
But I have narrowed down the problem so that answering one question technically answers both.
I have made many changes to .htaccess in a certain directory above the root. We'll just call it /dir. Somewhere along the way, I made a change that broke the way php runs files. My overall goal is to get php to run .php files again; however my question is about resetting the .htaccess for /dir. I created php files in the directory before /dir (previous/dir) and they run fine, so I just need to reset whatever changes are being held onto for that directory.
How can I clear all .htaccess for that directory.
Keep in mind, I have cleared the .htaccess file already. Whatever changes happened are being stored somewhere in apache that I can't get to. I just want to reset them and go back to where php was working in that directory.
Thanks.
The problem was that the original .htaccess had changed permissions to the directory because of password protecting. After I deleted the .htaccess file and the pwd, the permissions were still altered. After fixing the permissions I was easily able to fix everything.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Not much ago I upgraded to a dedicated server, and I order to make it more cost efficient for me, I decided rent some space on the server to people I know (friends, family). Some of the people I know have some other guy that is in charge of the website development, and I want to protect myself from an unauthorized access to my, or any of the other guys I rented to.
One of the cases which concerns me the most is PHP getting access to other users or me by accessing ../ from their root.
For instance, they could do something like this: foreach(glob('../*/*.*') as $some_file){unlink($some_file);} which would delete all the files from a sibling user.
How do I avoid people from doing this sort of things?
This sounds like an issue that can be resolved through system administration.
Edit your php.ini file, restricting the values in open_basedir
Make sure your users are assigned to different groups
chmod your home directories og-wx (e.g. 744, 740, 700, etc...)
Run multiple instances of apache server, possibly under different users/groups
It really depends on how much effort you want to put into it and how robust the security needs to be.
http://www.php.net/manual/en/ini.core.php#ini.open-basedir
http://wiki.apache.org/httpd/RunningMultipleApacheInstances
You should consider dctrucker post on permissions and make sure the apache process if you are running php with mod_php or the php processes if you are running it on fast-cgi dont have the permissions to change permissions. I wouldnt advice the base_opendir approach if security is your concern because then one can just use ini_set to override it (so if using that approach you should disable ini_set as well ).