Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 58/1273 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • PHP Dynamic include based on current file path

    - by Adrian M.
    Hello, I want to find a method to include some files based on the current file path.. for example: I have "website.com/templates/name1/index.php", this "index.php should be a unique file that I will use in many different directories on different depths, so I want to make the code universal so I don't need to change anything inside this file.. So if this "index.php" is located in "website.com/templates/name1/index.php" than it should include the file located here: "website.com/content/templates/name1/content.php" another example: "website.com/templates/name2/index.php" than it should include the file located here: "website.com/content/templates/name2/content.php" Also I want to overrun "*Warning: include_once() [function.include-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0*" kind of error.. because is disabled and unsafe.. Is there a way to achieve this? Thank you!

    Read the article

  • require wp-load.php 3 directories back

    - by sman591
    I'm trying to include a file (/wp-load.php) at the beginning of the /html/ directory. I'm trying to include it from /wp-content/themes/pw-steel-orange/index-load.php, but I always get the error message Warning: require_once(../wp-load.php) [function.require-once]: failed to open stream: No such file or directory in /nfs/c07/h01/mnt/102799/domains/platyworld.com/html/wp-content/themes/pw-steel-orange/index-load.php on line 1 Fatal error: require_once() [function.require]: Failed opening required '../wp-load.php' (include_path='.:/usr/local/php-5.2.6-1/share/pear') in /nfs/c07/h01/mnt/102799/domains/platyworld.com/html/wp-content/themes/pw-steel-orange/index-load.php on line 1 Am I doing something wrong? I though ../ brings the includes to the beginning directory Sorry if this is a duplicate, I couldn't find something related to this in my searches...

    Read the article

  • PHP Launch Execute Files Concurrently

    - by Ozzy
    Hi all. Basically, I was doing some testing using apache bench. The file i was testing takes 2 seconds to execute (its optimised, it connects to an external server hence the slowdown) Basically I found that the more concurrent useres i emulated, the more executions of the file i could do per second. Is there anyway that i can do something like this in php? : <?php execute_file('file.php'); execute_file('file.php'); execute_file('file.php'); execute_file('file.php'); execute_file('file.php'); ?> That would execute the file 5 times but would NOT wait for the files to finish downloading so the above example would quickly call the 5 functions then exit. Im assuming somesort of timeout would be used?

    Read the article

  • jquery load php file - result is not complete

    - by Mark Nolan
    I'm trying to load or better reload a DIV with content from an included php file. so the file is included in the webadmin.php from the location webadmin/pages.php. Then i alter some data in the DB through serializing. Now I would like to reload the pages.php from the callback of the serialize POST with load();. This all works fine up until the moment the data is supposed to be displayed in the div - i believe its because the php file is loaded from a different location, so the include paths for the DB Connection etc are probably wrong... Should I really write an extra PHP File for jquery or is there a way to tell jquery where to load it from? Its the first time I'm doing this - so bear with me for a moment on this one... Thanks! I guess it wont be much use, but heres the load code: $("#right").load("webadmin/pages.php");

    Read the article

  • htaccess Redirect - First Segment to PHP File, Second Segment as Parameter

    - by Steve
    My htaccess redirect knowledge is somewhat weak, so I was hoping to get some help here. I currently have the following redirect, which works well: # remove trailing slash RewriteRule ^(.*)/$ /$1 [L,R=301] # redirect to clean URL RewriteCond /%{REQUEST_FILENAME}.php -f RewriteRule ^([a-zA-Z0-9_-\s]+)$ /$1.php This takes a URL like www.mysite.com/about to www.mysite.com/about.php Now I would like to keep this behavior, but add parameters (if applicable), as such: www.mysite.com/about = www.mysite.com/about.php www.mysite.com/gallery/1 = www.mysite.com/gallery.php?id=1 If possible, I might like to expand this system to 2 or more parameters, as such: www.mysite.com/gallery/1/2 = www.mysite.com/gallery.php?id=1&section=2 So the pattern would be: First URL segment redirects to a PHP file (Optionally) the second segment gets added as the id parameter (Optionally) the third segment gets added as the section parameter

    Read the article

  • php is not recognized as an intern command (using windows)

    - by Tristan
    Hello, I want to develop using a framework called symfony BUT, i do not have a MAC and i don't want to dual boot with Debian. I tryed virtual hosts via Virtual Box but it's too crappy. So i decided to stay on windows So when the tutorial tells me to do php lib/vendor/symfony/data/bin/check_configuration.php i do in the windows cmd : php lib\vendor\symfony\data\bin\check_configuration.php and it tells me : 'php' is not recognized as an internal or external command I use UwAmp (php 5.2.12 + mysql + apache) which is stored in E:\logiciels\UwAmp\ inside i have buch of file, but i guess that is important : E:\logiciels\UwAmp\apache\php_5.2.11 How to make the cmd PHP in the windows cmd work propely please?

    Read the article

  • php: security question

    - by Syom
    in my cms i have index.php, where client must enter username and password. if they are correct, he'll moove to admin.php, where the cms is. but now hacker can enter to cms/admin.php, so my security now is awful. i know, that i can use $_SESSION variable. index.php - i can give some value to $_SESSION['error']: $_SESSION['error'] = TRUE, and in admin.php just verify it admin.php if($_SESSION['error'] == TRUE) { my script here... } else header("Location: index.php"); but i want to rich this effect without SESSION. could you give me an idea, how can i do it? thanks

    Read the article

  • PHP Fatal error on line number that doesn't exist

    - by alexantd
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /Library/WebServer/Documents/XMLDataStore.class.php on line 981 The curious thing about this error is not the memory leak, which would be easy enough to troubleshoot. Rather, it is the fact that XMLDataStore.class.php is only 850 lines long, which I have verified in multiple text editors. This is with the PHP 5.3 bundled with Snow Leopard. I'm not using an opcode cache. Here is my php.ini: allow_url_fopen = Off error_reporting = -1 display_errors = 1 display_startup_errors = 1 date.timezone = 'America/Los_Angeles' output_buffering = Off realpath_cache_size = 0k XMLDataStore.class.php has recently been refactored and it used to be longer than 981 lines. It's almost as if PHP has cached a 2-week-old version and is reading that. I'm positive that the current version at /Library/WebServer/Documents/XMLDataStore.class.php is only 850 lines long, though.

    Read the article

  • Execute a method less times possible - PHP

    - by serhio
    I have a site in multiple languages. I have a method that returns me the today currencies in a array. I display that currencies in a table then. // --- en/index.php <?php include_once "../exchangeRates.php"; $currencies = ReadExchangeRates(); // --- fr/index.php <?php include_once "../exchangeRates.php"; $currencies = ReadExchangeRates(); ... // somewhere in the page <td><?php echo $currencies["eur"]["today"]; ?></td> So, every time I load, en/ or fr/ or other language, I request the exchange rates from a external site. Can I optimize this behavior (reading once per day or session)? maybe to store a global variable and check the update date?

    Read the article

  • Accessing global variables within functions in PHP

    - by st3
    There are multiple times in one page where I need to connect and subsequently query a MySQL database, yet my code won't let me. I think it might be something to do with how my files are nested but it makes no sense. I am opening the SQL connection in the header file. The top of the offending page looks like the following: <?php $page_title = 'Dashboard'; include('templates/header.inc'); // includes a 'require_once('mysqli_connect.php') and a small query to the database; require_once('includes/functions.php'); require_once('includes/dashboard_sql.php'); // Contains functions which connect to database (which are failing.) ?> I get the PHP error Notice: Undefined variable: dbc in /Library/WebServer/Documents/pediatory_site/includes/dashboard_sql.php Where $dbc is the database connection defined in mysqli_connect.php. If anyone could help me out that would be great.

    Read the article

  • php drop down how to control the hide and show

    - by user329394
    Hi all, i want to control the drop down box to control show or hide statement. I do like this but it seems it doesn't work, i have it working if im using radio button. can help me with the code? which part am i wrong? thank you. $dbcnx = mysql_connect('localhost', 'root', ''); mysql_select_db('dbase'); if($_POST['gred'])$gred=$_POST['gred'];else $gred=""; <script language="JavaScript"> function funcHide(elemHide1,elemHide2,elemHide3) { document.getElementById(elemHide1).style.display = 'none'; document.getElementById(elemHide2).style.display = 'none'; document.getElementById(elemHide3).style.display = 'none'; document.getElementById(elemShow).style.visibility = 'visible'; } function funcShow(elemShow1,elemShow2,elemShow3) { document.getElementById(elemShow1).style.display = 'block'; document.getElementById(elemShow2).style.display = 'block'; document.getElementById(elemShow3).style.display = 'block'; document.getElementById(elemShow1).style.visibility = 'visible'; document.getElementById(elemShow2).style.visibility = 'visible'; document.getElementById(elemShow3).style.visibility = 'visible'; } </script> <table> <tr> <td>Gred </td> <td>:</td> <td><select name="gred" id="gred"> <option value="">&nbsp;</option> <option value="A17" <?php if($gred=='A17')echo "selected";?> onClick="funcShow('box1', 'box2', 'box3');">A17</option> <option value="A22" <?php if($gred=='A22')echo "selected";?>>A22</option> <option value="A27" <?php if($gred=='A27')echo "selected";?>>A27</option> </select> </td> </tr> <tr> <td>TK</td> <td>:</td> <td> <select name="tk" id="tk"> <option value="">&nbsp;</option> <option value="01" <?php if($tk=='01')echo "selected";?>>01</option> <option value="02" <?php if($tk=='02')echo "selected";?>>02</option> <option value="03" <?php if($tk=='03')echo "selected";?>>03</option> <option value="04" <?php if($tk=='04')echo "selected";?>>04</option> <option value="05" <?php if($tk=='05')echo "selected";?>>05</option> <option value="06" <?php if($tk=='06')echo "selected";?>>06</option> </select> <?} ?> </td> </tr> <tr> <td colspan="2" valign="top">Status</td> <td valign="top">:</td> <td> <?php $qry = "SELECT * from dtable where userid='".$USER->id."'"; $sql = mysql_query($qry); $row = mysql_num_rows($sql); if($row==0) { ?> <input type=radio name="status" <?php if($status=='retake') {?>checked="checked"<?php } ?> value="retake" onClick="funcShow('box1', 'box2', 'box3');">Retake<br /></tr> <tr> <td colspan='2'> <div id="box1" style="display: none;">Last Date <br> Latest Date<br> </div></td> <td><div id="box2" style="display: none;">: <br> : <br></div></td> <td> <div id="box3" style="display: none;"> <?php $rsu[lastdate] ?> <br> <?php $rsu[latestdate] ?> </div> </td>

    Read the article

  • How to avoid resending data on refresh in php

    - by Priyanka
    Hello.I have a page "index.php" where i have a link called "add_users.php".In "add_users.php",i accept user information and come back to the same page "index.php" where information comes through post action and gets inserted into the database.When i refresh the page orhit back button,resend box appears.I went through many solution where they asked me to create third page.I tried doing that as follows:After inserting values in database,I redirected ht page as header('Location:http://mysite.com/thankyou.php, and in thankyou.php I again redirected the page to index.php.But getting warning as Cannot modify header information - headers already sent by.... provide me a better solution. Thank You in advance.

    Read the article

  • Confused as to why my PHP include isn't working

    - by Sam
    I had a prototype of my website working correctly, meaning it connected to the database correctly. This was done with just one file called "connect.php" which had mysql_connect() and such inside it. I then separated the connect information into to separate files, one containing the account information (account.php) and one containing the connect function (connect.php), with correct information (I triple checked) and it isn't connecting properly. All I can think of is that I'm not including it the right way. This is what I have in a file: <?php include('account.php'); include('connect.php'); include('functions.php'); ..... ?>

    Read the article

  • Is putting $_GET in headers safe? (PHP)

    - by ggfan
    In my profile.php script, I have a flag function that allows users to flag that user. If they flag a user, it sends data (user_id, reason, etc) to a file called flag.php which does all the banning and stuff. The data is sent to flag.php through header("Location: flag.php?user_id=___&reason=___") Then in flag.php, after it does all the banning, it redirects the user back to the profile through another header. The user never sees the flag.php. Is my flag.php safe? because they never see the script?

    Read the article

  • Deny access to a PHP file (Nginx)

    - by Desmond Hume
    I want Nginx to deny access to a specific PHP file, let's call it donotexposeme.php, but it doesn't seem to work, the PHP script is run as usual. Here is what I have in the config file: location / { root /var/www/public_html; index index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/public_html$fastcgi_script_name; include fastcgi_params; } location /donotexposeme.php { deny all; } Of course, I do sudo service nginx reload (or restart) each time I edit the config.

    Read the article

  • My website directories downloads instead of actually opening up from browser

    - by numerical25
    I added some screencast to show what I am having issues with http://screencast.com/t/212t3ANINqk http://screencast.com/t/bR44U1wkvNZl http://screencast.com/t/iDS7APYYsa but the page downloads my subdirectories instead of opening them up and displaying the index file of that page Here is the situation. I am trying to get my web service up using mac ports and I am just trying to configure all the files. I am using php, apache, etc. the page goes to the localhost root but anything beyond that. it can not find. edit Ive tried to add the following to httpd.conf within the <IfModule mime_module> but no hope AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php .html AddType application/x-httpd-php-source .phps

    Read the article

  • Would Using a PHP Framework Be Beneficial in My Context?

    - by Fractal
    I've just started work at a small start-up company who mainly uses PHP to develop their front-end apps. I had no prior PHP experience before joining, and this has led to my apps becoming large pieces of spaghetti code. I essentially started by adding code to implement an initial feature, and then continued to hack in more code to implement further features – without much thought for the overall design. The apps themselves output XML to render on small mobile devices. I recently started looking into frameworks that I could use. I reckon an advantage would be that they seem to force developers to modularise their programs using good-practice design patterns. This seems great for someone in my position. The extra functions they provide, for example: interfacing with databases in such a way as to make SQL injection impossible, would be very useful too. The downside I can see is that there will be a lot of overhead for me in terms of the time taken to learn the framework itself (while still getting to grips with PHP itself). I'm also worried that it will be overkill for the scale of the apps we develop. They tend to be programs that interface with a fairly simple back-end DB, and will generate about 5 different XML screens. Probably around 1 or 2 thousand lines of code. The time it takes just to configure the frameworks may not be worth it. The final problem I can see is that developers in the company – who have to go over my code, and who do not know the PHP framework I may use – will have a much harder time understanding it. Given those pros and cons, I'm still not sure on what the best course of action will be; so any advice will be greatly appreciated.

    Read the article

  • Why is there no facility to overload static properties in PHP?

    - by Jon
    Intro PHP allows you to overload method calls and property accesses by declaring magic methods in classes. This enables code such as: class Foo { public function __get($name) { return 42; } } $foo = new Foo; echo $foo->missingProperty; // prints "42" Apart from overloading instance properties and methods, since PHP 5.3.0 we can also overload static methods calls by overriding the magic method __callStatic. Something missing What is conspicuously missing from the available functionality is the ability to overload static properties, for example: echo Foo::$missingProperty; // fatal error: access to undeclared static property This limitation is clearly documented: Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. As of PHP 5.3.0, a warning is issued if one of the magic overloading methods is declared static. But why? My questions are: Is there a technical reason that this functionality is not currently supported? Or perhaps a (shudder) political reason? Have there been any aborted attempts to add this functionality in the past? Most importantly, the question is not "how can I have dynamic static properties in userland PHP?". That said, if you know of an especially cute implementation based on __callStatic that you want to share then by all means do so.

    Read the article

  • Is it bad practice to output from within a function?

    - by Nick
    For example, should I be doing something like: <?php function output_message($message,$type='success') { ?> <p class="<?php echo $type; ?>"><?php echo $message; ?></p> <?php } output_message('There were some errors processing your request','error'); ?> or <?php function output_message($message,$type='success') { ob_start(); ?> <p class="<?php echo $type; ?>"><?php echo $message; ?></p> <?php return ob_get_clean(); } echo output_message('There were some errors processing your request','error'); ?> I understand they both achieve the same end result, but are there benefits doing one way over the other? Or does it not even matter?

    Read the article

  • configuration issue with respect to .htaccess file on ubuntu

    - by Registered User
    I am building an application tshirtshop I have following configuration in /etc/apache2/sites-enabled/tshirtshop <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/tshirtshop <Directory /var/www/tshirtshop> Options Indexes FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> and following in .htaccess file in location /var/www/tshirtshop/.htaccess <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On # Specify the folder in which the application resides. # Use / if the application is in the root. RewriteBase /tshirtshop #RewriteBase / # Rewrite to correct domain to avoid canonicalization problems # RewriteCond %{HTTP_HOST} !^www\.example\.com # RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] # Rewrite URLs ending in /index.php or /index.html to / RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L] # Rewrite category pages RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2&Page=$3 [L] RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2 [L] # Rewrite department pages RewriteRule ^.*-d([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&Page=$2 [L] RewriteRule ^.*-d([0-9]+)/?$ index.php?DepartmentId=$1 [L] # Rewrite subpages of the home page RewriteRule ^page-([0-9]+)/?$ index.php?Page=$1 [L] # Rewrite product details pages RewriteRule ^.*-p([0-9]+)/?$ index.php?ProductId=$1 [L] </IfModule> the site is working on localhost and is working as if there is no .htaccess rule specified i.e. if I were to view a page as http://localhost/tshirtshop/nature-d2 then I get a 404 Error but if I view the same page as http://localhost/tshirtshop/index.php?DepartmentId=2 then I can view it. sudo apache2ctl -M Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_prefork_module (static) http_module (static) so_module (static) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) mime_module (shared) negotiation_module (shared) php5_module (shared) reqtimeout_module (shared) rewrite_module (shared) setenvif_module (shared) status_module (shared) Syntax OK What is the mistake if any one can point out in above configuration, or else I need to check any thing else?

    Read the article

  • What and all the areas of Linux a PHP developer should know about? (Like just commands of it or something advanced)

    - by droidsites
    I've developed a website using PHP but I implemented it on Windows OS and hosted it on Windows server. I just searched the PHP job market to know the on-going technology requirement and to keep my knowledge up-to-date accordingly with the job market. I see more are asking for LAMP stack. I understand the sort of skills required for a developer in PHP and MySQL. But coming to the Linux and Apache what kind of the skills exactly companies expect from a developer? On what should I be focusing in case of Linux, Apache whilst developing my website using these LAMP stack? I am going to develop a new website and want it to be using LAMP. But I want to know what difference it makes? Why LAMP stack got more demand in the job market compared to WAMP ? Edit: Sorry I thought my question is creating confusion ... so I put my question in different words as What and all the areas of a Linux a PHP developer should know about? (Like just commands of it or something advanced) Note: I am Linux newbie

    Read the article

  • Trying to move away from PHP/Yii: RoR, Python/Django or ASP.NET MVC? Your opinions please [closed]

    - by Örs
    I have a CS degree and I've been working as a web developer (front & backend) for about 2 years now. I've been working with PHP mostly because it was easy to pick up and find a job, but I've grown to dislike the language and want to try something new, and possibly get a better paying job. That last point is especially important because in my area (Romania/Eastern Europe) PHP jobs are mostly for people fresh out of college/high school, hence the pay is rather low. I've been working with the Yii framework which, if I understand correctly, borrows a lot from Ruby on Rails (convention over configuration, MVC, Active Record, scaffolding). Other than PHP I only know curly-brace languages (C/C++/Java) and bash so Python/Ruby might be a bit challenging. On the other hand I've been using Linux (with vim and recently Sublime Text 2) for almost 4 years now so Windows and a lack of a terminal would have its downsides as well. I'm leaning towards Python/Ruby because of my *nix bias (plus both look like fun), but I've heard great things about ASP.NET MVC as well. Any suggestions? PS: I think there are more jobs in ASP.NET around here, but that's not necessarily a plus, because there are a lot of CS graduates as well. tl;dr: Romanian PHP/Yii developer trying to move to Python/Django or Ruby/Rails or C#/ASP.NET MVC. Suggestions?

    Read the article

  • What and all the areas of a Linux a PHP developer should know about? (Like just commands of it or something advanced)

    - by droidsites
    I've developed a website using PHP but I implemented it on Windows OS and hosted it on Windows server. I just searched the PHP job market to know the on-going technology requirement and to keep my knowledge up-to-date accordingly with the job market. I see more are asking for LAMP stack. I understand the sort of skills required for a developer in PHP and MySQL. But coming to the Linux and Apache what kind of the skills exactly companies expect from a developer? On what should I be focusing in case of Linux, Apache whilst developing my website using these LAMP stack? I am going to develop a new website and want it to be using LAMP. But I want to know what difference it makes? Why LAMP stack got more demand in the job market compared to WAMP ? Edit: Sorry I thought my question is creating confusion ... so I put my question in different words as What and all the areas of a Linux a PHP developer should know about? (Like just commands of it or something advanced) Note: I am Linux newbie

    Read the article

  • How can I make my PHP development environment more efficient?

    - by pixel
    I want to start a home-brew pet project in PHP. I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently. In my previous PHP work, I've used a windows desktop machine and a linux server for development. This configuration had it's advantages: it's easy to configure Apache (and it's modules)/PHP/MySql on a linux box, and, at the time, this configuration was the same like on production server. However, I never successfully set up a debug connection between my Eclipse install and X-debug on server. Transferring files from my local workspace to the server was also very annoying (either ftp or Bazaar script moving files from repository to web root). For my new setup, I'm considering installing everything on my local machine. I'm afraid that it will slow down workstation performance (LAMP + Eclipse), and that compatibility problems will kick-in. What would you recommend? Should I develop using two separate machines? On one? Do you have experience using one of above configurations in your work?

    Read the article

  • How can I make my PHP development environment more efficient?

    - by pixel
    I want to start a home-brew pet project in PHP. I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently. In my previous PHP work, I've used a windows desktop machine and a linux server for development. This configuration had it's advantages: it's easy to configure Apache (and it's modules)/PHP/MySql on a linux box, and, at the time, this configuration was the same like on production server. However, I never successfully set up a debug connection between my Eclipse install and X-debug on server. Transferring files from my local workspace to the server was also very annoying (either ftp or Bazaar script moving files from repository to web root). For my new setup, I'm considering installing everything on my local machine. I'm afraid that it will slow down workstation performance (LAMP + Eclipse), and that compatibility problems will kick-in. What would you recommend? Should I develop using two separate machines? On one? Do you have experience using one of above configurations in your work?

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >