I have developed some pages in PHP and HTML. But the PHP pages were not working when I put these pages in OpenWrt www folder. I have installed php5 in OpenWrt. These pages were working fine with apache localhost in ubuntu. In OpenWrt, It has uHTTPd. Do I need to install anything other than just php5 (other modules) or Do I need to configure something?
For PHP5 configuration on OpenWRT see: http://wiki.openwrt.org/doc/uci/uhttpd
First, install PHP
opkg update
opkg install php5
opkg install php5-cgi
Install any other additional php5 extensions you may use. To see available packages:
opkg list php5*
Example:
opkg install php5-mod-sockets
Open your /etc/php.ini and uncomment any of the extensions you just installed. Continuing with the sockets example above the following:
;extension=sockets.so
becomes
extension=sockets.so
Now open /etc/config/uhttpd and add the following line:
list interpreter ".php=/usr/bin/php-cgi"
Don't forget to restart uhttpd:
/etc/init.d/uhttpd restart
One option in regards to your space (flash) limitations of installing PHP on your embedded device: if you have access to a USB port on your embedded device (like many do) you can set up your base openWRT configuration with extroot. Essentially you will boot to a USB drive thereby enabling all of the space of the USB drive to install packages and add files. See: http://wiki.openwrt.org/doc/howto/extroot
Actually you do need to install a server (such as Apache), and if you want data persistence, a database (such as MySQL)
I found a complete guide for exactly what you wish:
http://wiki.openwrt.org/doc/howto/lamp
Related
I've been having some issues installing PHP 5.5 on a CentOS machine using Chef. I was finally able to install it, but when I access the index.php it just download a file with the content.
I'm guessing it's because Apache (technically Httpd, as I'm with CentOS) doesn't have mod_php installed/configured.
I installed PHP using php cookbook with the following packages:
# ... code to add webtatic repository to yum
node.set['php']['packages'] = ['php55w', 'php55w-devel', 'php55w-cli', 'php55w-snmp', 'php55w-soap', 'php55w-xml', 'php55w-xmlrpc', 'php55w-process', 'php55w-mysqlnd', 'php55w-pecl-memcache', 'php55w-opcache', 'php55w-pdo', 'php55w-imap', 'php55w-mbstring']
If I'm right, the code above didn't install mod_php. The following is my web chef recipe:
httpd_service 'apps' do
mpm 'prefork'
action [:create, :start]
listen_ports ['80', '443']
end
# ... code for virtual hosts
# Install the mod_php Apache module.
# httpd_module 'php' do
# instance 'apps'
# end
I had the httpd_module 'php' directive uncommented when using PHP 5.4. What's the correct name for the http_module to work with PHP 5.5?
It looks like you've found one of the people who went the Debian route and set their packages up as php55- instead of php-. That makes things a pain if you want to go from 5.5 to any higher version, because you're having to uninstall those and install the new ones (i.e. php70-).
Instead I recommend switching your recipe to the Remi repo and use the php- packages.
All that having been said, php55w is your base PHP package. I don't see a php55w-common package tho. Try adding that (or php-common) and that should get it into Apache.
I recently started hosting my own website thanks to the OVH "personal formula" and found some web-based app that I would like to install on my server. It requires the pdo_mysql extension and GD library to run. I read that I needed access to the php.ini file to download them.
However, I don't have access to the php.ini file. Is there another way to install both of these extensions ? (Maybe editing the htaccess file...?)
I'm using windows, My current PHP version is : 5.6.17,
I use a MYSQL v.5.5 database
Thanks
You normally need access to php.ini to enable or disable modules.
It really would surprise me if your shared hosting provider didn't already have pdo_mysql and GD enabled though. Have you checked the modules aren't already available.
Ubuntu Linux users
Run the following command to install GD:
sudo apt-get install php5-gd
Restart your Apache web server.
And in Windows you can use
dl function
bool dl ( string $library )
I'm trying to migrate a PHP website from AWS to Azure and have created a website in the Azure UI.
I've installed composer using the Kudu console and have overridden a few php.ini settings via the .user.ini file I created in the root. I've also added php_memcache.dll to my wwwroot/bin directory and enabled this in app settings within the Azure UI.
However, when running composer install using using the console I get an error because it can't find the memcache library. I assume because I haven't added this to the command line php.ini file. Does anyone know how to to edit this?
This is the error I get when I run composer install:
- The requested PHP extension ext-memcache * is missing from your system.
Edit - Solution
Looks like I've managed to run composer install using the following command:
php -d extension=D:\home\site\wwwroot\bin\php_memcache.dll bin\composer.phar install
Is it possible to run this without specifying the extension and using composer install instead of bin\composer.phar install`?
To add an extension to PHP app on an Azure website, it is easier to configure it from your Azure portal. The official Azure documentation on PHP configuration should help, just search on that page for "How to: Enable extensions in the default PHP runtime".
I wasn't able to find a way to get CLI extensions onto Azure. I did find that
composer install --ignore-platform-reqs
Does the install without blocking on missing PHP extensions.
I am trying to enable XSL on Ubuntu 12.04 but its failing. I did this locally on my Ubuntu 13.04 and it was successful. Basically the following worked on my local computer.
apt-get install php5_xsl
edit php.ini file and add extension=php5_xsl.so
restart apache
I repeated the same procedures on my production server running Ubuntu 12.04 and PHP version 5.5.12 but the extension is not getting loaded from the phpinfo. I have also changed the extension=php5_xsl.so to extension=xsl.so because this is what in the extension directory.
I read that I might need to recompile PHP but I am not sure of this steps.
Try this:
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Why:
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
What's happened here is that all debian-flavoured unixes have adopted
this standard for their PHP 5.4 packages, so if you're using debian,
ubuntu, or any of their relatives with PHP 5.4, you'll see a directory
structure like this. When you add a module to PHP, you'll add a file
to the mods-available directory enabling the module and adding any
config specific to it. If you want to enable the module, just do:
php5enmod http
This simply creates a symlink from the usual conf.d directory to point
to where the real files are in mods-available, prefixed with a number
that indicates the priority of the module. By default, the priority is
20.
Using this approach means we can toggle things on and off without
commenting out big chunks of config files and leaving them lying
around - if this seems familiar then that's no surprise; debian-like
linuxes manage their apache configuration in just the same way. Any
packages that you install using aptitude will use these exact same
commands to set up the configuration and then symlink it correctly. To
unlink, use the delightfully predictably-named php5dismod :)
I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code.
My question is that I can't seem to get the Postgre extension working in PHP. I checked the php.ini file, there were no "extension=..." lines. So I added "extension=pgsql.so". I then checked the "extension_dir" and found that there were only 2 files in there (ldap.so, phpcups.so), I added a pgsql.so file taken from another Linux box. I restarted httpd. And it does not work. I couldn't find any "pgsql" or "postgre" in phpinfo().
Forgive my noobness. I know too little Linux. I would really appreciate it if you can point me to the right direction.
I used the suggestion given by number5:
Dude, I'm on RedHat. I used the "yum" version of the command you gave, and I got this:
[root#perseus ~]# yum install php-pgsql
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=extras error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: extras
UNFORTUNATELY, the Linux server I'm using is NOT connected to the Internet. Any other way to install?
It depends on which Linux distro you are using.
If you are using Ubuntu/Debian, you need to:
sudo apt-get install php5-pgsql
Fedora/CentOS
yum install php-pgsql
usually you can find out which distro you are on by:
ls /etc/*-release
On CentOS extensions create separate *.ini file one per each php extension in /etc/php.d
So, don't alter main *.ini file, but create /etc/php.d/pgsql.ini and add there a line
extension=pgsql.so
Then you will need to restart Apache using
service httpd restart
But the best automated way is to just type
yum install php-pgsql
In your case that didn't work because of some problems in yum configuration. Go to /etc/yum-repos.d
Type
nano /etc/yum.repos.d/CentOS-Base.repo
Scroll down to [extras] section and ensure it is like this:
#additional packages that may be useful
[extras]
priority=1
name=CentOS-$releasever - Extras
=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Correct it if needed, save file (Ctrl-X) and do the following:
yum clean all
yum upgrade
Afterwards try to repeat
yum install php-pgsql
Remove the .so file you've copied from the other machine (though it might work, there's no need to take the risk)
Use the distribution's package manager to install the php_pgsql/php5_pqsql module
Restart the apache and try again. Maybe the module has been added to an .ini file automagically
If not, run <?php echo 'ini: ', get_cfg_var('cfg_file_path'); to see which php.ini you have to edit
edit this ini file
restart the apache
My operation system Linux mint kde and there was same issue
pg_connect()
You must install if you are use php5.6
sudo apt-get install php5.6-pgsql
After you must change extention name in "php.ini" file.
;extension=php_pgsql.dll
'dll' to 'so'
For example
extension=php_pgsql.so