I have a vps with zpanel installed and apache2 - php - mysql.
I'm developing a small backend for a website in php, for sites ready to publish the situation is perfect, but now I need to disable the server feature that caches php files to test instantly the correct (last modified version) of my php files.
This is because while html and js files, when edited, are reloaded correctly immediately, with php I have a long wait before it updates or I have to restart the server.
I tried to open php.ini and look for "cache" and set to "1" millisecond almost all the values with no luck.
what could I try?
P.S. it's not a browser cache problem, that's a server side problem.
Solved: inside php.ini I added a line with
apc.enabled=0
after that I restarted apache2 and now php files are updated istantly as they should
thanks for the suggestion to look into phpinfo
Related
I have just cloned a project, so it works perfectly fine when i load it e.g: "localhost/example/contact.html", but when i click to homepage which the endpoint is "localhost/example/index.php" it asks me to save the file like that:
Asking to save the php file
I have checked everything in files such as php.ini, httpd.conf but still cant find a solution, I also reinstalled wamp 2 times.
Also the php error log gives me this error: The file C:/WINDOWS/system32/drivers/etc/hosts does not exists
Any help would be appreciated!
You need to load and enable mod_php or set up php-fpm. Afaik Wamp uses mod_php which is simpler. The reason your web browser asks you to download the php files is because you have not told the web server to treat .php files differently that .txt files.
There are plenty of resources on the interwebs about setting up php and apache:
https://cwiki.apache.org/confluence/display/HTTPD/PHP
Given that you are using Wamp, which should work out of the box, I'd say reinstall one more time and run the installer as an admin. If the issue about the etc/hosts file persists, you can create the file yourself.
However, I don't think the hosts file is necessary to run wamp or to render / run .php files.
PS: Your question is not about programming or code, so it's going to be closed because it fits better on the superuser website. Welcome to SO!
I think I'm having the same issue as this link: Apache is downloading php files instead of displaying them
I'm trying to install Roundcube on my Linode server but when I go to www.myurl.com/roundcube it downloads the php files.
I read through that link and I see people saying to add things to different files, but I don't know where to look.
I'm new to Linode, I'm used to hosts with cPanels and such. So, I need a bit of a point in the right direction.
With linode you have the raw server ie you need to ssh into it and configure it. Start with this guide.
https://www.linode.com/docs/websites/hosting-a-website
Once you have a basic site running then configure apache to use PHP.
I setup a WAMP stack for the first time using Bitnami. Got working pretty quickly with vhost and everything, running a couple WordPress websites for local development. The problem is, nearly everytime I save a change to a PHP file the changes don't appear when I refresh the browser unless I restart the Apache server.
I've searched around for a couple days now for a solution but nothing seems to work, considering going back to XAMPP for local development. I tried to disable opcache in the php.ini as someone suggested but that didn't work.
Any ideas what it could be?
In httpd.conf comment out:
# Include conf/pagespeed.conf
# Include conf/pagespeed_libraries.conf
In php.ini set:
opcache.enable=0
opcache.enable_cli=0
Source
I've been developing a PHP application using the Zend framework for awhile on a Linux-based hosting provider, and it's gone along more or less swimmingly.
The time has come to be able to develop locally on my Mac, so I configured Apache to run PHP, grabbed the source code, and symlinked /Library/WebServer/Documents to the public/ folder in my Zend web app.
That was fine. The controllers were executing and loading the correct scripts, which seemed to parse and render correctly. Except, I wasn't able to connect to my local MySQL database. I realized that I hadn't copied /etc/php.ini.default to /etc/php.ini, so I went ahead and did that. I then updated this line:
pdo_mysql.default_socket=/tmp/mysql.sock
and restarted Apache. Now, suddenly, none of the PHP executes. Instead, the raw PHP is sent back to the browser.
The effect is more or less the same as if I was trying to load a .php file directly with an Apache instance that didn't recognize the .php file extension. Based on what I've experienced, I'm guessing that maybe somewhere in php.ini there is a setting that is causing this to happen (when I rename php.ini and restart Apache, the scripts once again parse and render correctly, but again I can't hit the database) but I'm not sure where to look. Does anyone have any thoughts?
In case anyone is reading this, here's the answer that I finally discovered:
short_open_tag = On
The above needs to be set in php.ini, particularly because all of my controllers, models, helpers, etc were using short tags (e.g. ), as is common with Zend applications.
I have a local install of Apache / MySQL and PHP on Fedora Linux.
I know PHP is running ok as some of my websites are running fine and if I create a simple file I can see I am running PHP 5.4.1.
Searching Google brings up tons of hits where the issue is PHP is not running at all but that isn't the case here - it's only one site that displays as plain text instead of processing as php.
I'm sure it's some kind of seeting in httpd.conf but have had a look and there is nothing obvious (to me anyway).
If some pages work and some don't check if it's a short_open_tag in php.ini issue. (it allows for <? instead of only <?php)