我正在尝试在 Ubuntu 的本地主机中使用 HTML 和 PHP 保存数据。我的 HTML 和 PHP 文件运行良好,但是当我使用命令在本地主机中打开文件时,使用
$myfile = fopen("testfile.txt", "w")
Run Code Online (Sandbox Code Playgroud)
它不允许它创建它,但 PHP 文件正在运行,当使用命令设置从 PHP 输出变量时,它运行良好。
如何允许 PHP 在 localhost Ubuntu 中的 Apache 中创建文件。
当我尝试使用sudo apt-get install php5-mcrypt安装 php5-mcrypt 时,收到以下错误。我曾经sudo apt-get install lamp-server^安装过php5
ahmad@ubuntu:/var/www/html$ sudo apt-get install php5-mcrypt
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-mcrypt is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-mcrypt' has no installation candidate
Run Code Online (Sandbox Code Playgroud) 我已经安装了Tomcat的以下发行版:http : //mirror.its.dal.ca/apache/tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4.tar.gz
我一步一步地遵循了这个说明:https : //www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04
我已经使用命令启动了该服务sudo systemctl start tomcat,但出现以下错误:
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)
提前谢谢你的帮助!
阅读此处后,我将以下代码块放入我的apache2.conf:
<ifmodule mod_expires.c>
<Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
ExpiresActive on
ExpiresDefault "access plus 2 days"
</Filesmatch>
</ifmodule>
Run Code Online (Sandbox Code Playgroud)
然后我重新启动了 Apache 并刷新了所有 CMS 缓存,并运行了 GPI 测试,在其中我仍然收到以下错误,表明该模块不起作用:
利用浏览器缓存
在静态资源的 HTTP 标头中设置到期日期或最长期限会指示浏览器从本地磁盘而不是通过网络加载先前下载的资源。
我认为原因是它mod_cache没有打开,所以我做了a2enmod cache然后在我网站的 Vhost 中粘贴了以下代码并重新启动了 Apache。它也没有帮助,我仍然在 GPI 中遇到相同的错误:
CacheQuickHandler off
CacheLock on
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 5
CacheIgnoreHeaders Set-Cookie
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我的问题是启用 mod_expires 可能缺少什么,为什么它不起作用?
我有端口号是的 nodejs 应用程序,3001这个应用程序使用 http 但不适用于 https。在Apache服务器,用于设置翻领代理80或443到5001和一套翻领代理的3001也。
http://<domain>:3001/socket.io/socket.js ---> Work
https://<domain>:3001/socket.io/socket.js ---> Not Work(Secure Connection Failed or This site can’t be reached)
Run Code Online (Sandbox Code Playgroud)
在这里,我需要知道相同的端口(3001)与http和一起使用https?
有什么解决办法吗?
所以我试图在 Ubuntu 16.04 amazon ec2 实例上安装 webmin。我已经安装了 apache2、php7、mariadb。我一直在使用http://www.htpcbeginner.com/how-to-install-webmin-on-ubuntu/ guide 并且一切正常,直到出现此错误时 apt-get install 。
Reading package lists... Done
Building dependency tree
Reading state information... Done
N: Ignoring file 'webmin.list.' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Unable to locate package webmin
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
当我尝试从这个命令安装 PHP7 时:
sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-cgi
Run Code Online (Sandbox Code Playgroud)
然后我得到错误:
couldn't find or unable to locate all these packages.
Run Code Online (Sandbox Code Playgroud)
所以我想从php.net下载 php7.1 ,然后用 Apache 运行。这样做的过程是什么?如何配置像apache2.conf&php.ini这样的文件来运行 PHP?
从这个问题我知道升级 ubuntu 不会升级 php。
此外,从10.04升级到16.04已经提到3个步骤在这里。
我当前的 Ubuntu 版本是 10.04.4 LTS
Apache: 2.2.14
Mysql: 5.1.66
Php: 5.3.2
Run Code Online (Sandbox Code Playgroud)
仅供参考,根据我之前的问题,我正在尝试升级到 ubuntu 16.04 以更新到 TLS1.2
我有点困惑,因为我是 ubuntu 的新手。请指导我。
我正在尝试设置 Apache2 服务器。安装和配置似乎进行得很顺利,但是当我尝试访问我的自定义 Web URL 时,出现“无法访问此站点”错误。我已尝试通过此答案设置配置文件 -尝试在浏览器中访问 Apache 2.4.7 Web 服务器时出现 Forbidden 403 错误。
我的主机文件如下所示:
127.0.0.1 localhost
127.0.0.1 justtestingthis
127.0.1.1 Hacker
# The following lines are desirable for IPv6 capable hosts
...
Run Code Online (Sandbox Code Playgroud)
我的apache2/sites-available/http.justtestingthis.conf文件看起来像这样:
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@example.com
ServerName justtestingthis.com
ServerAlias www.justtestingthis.com
DocumentRoot /home/donatas/Desktop/Projects/justtestingthis/dist/src
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/donatas/Desktop/Projects/justtestingthis/dist/src>
# Allow .htaccess
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我还在apache2/sites-enabled使用sudo a2ensite http.justtestingthis.conf.
当我通过输入http://localhost访问该网站时,我的网站被成功找到,但是当我尝试通过 justtestingthis.com 或 www.justtestingthis.com 访问它时,我得到“这个网站无法到达错误”... …